Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidPeerType = errors.New("invalid peer type")
)
Functions ¶
func DeriveSharedSecret ¶
func DeriveSharedSecret(ours EphemeralKeyPair, theirs PeerPublicKey) ([]byte, error)
Derives a 64-byte shared secret given one party's ephemeral keypair and another party's ephemeral public key obtained from ECDH.
The secret is computed using the following KDF (similar to libsodium):
blake2b-512(q || client-pub || server-pub).
where q is the 32-byte x25519 shared secret.
The client and server's public keys must be ordered the same way on both sides, so the peer's type (client or server) must be provided along with the peer's public key.
Types ¶
type EphemeralKeyPair ¶
func NewEphemeralKeyPair ¶
func NewEphemeralKeyPair() EphemeralKeyPair
Creates a new x25519 keypair for use in ECDH key exchange.
type PeerPublicKey ¶
Click to show internal directories.
Click to hide internal directories.