Documentation
¶
Overview ¶
Package kex wraps the go.crypto Curve25519 primitive for ease of use.
Index ¶
Constants ¶
View Source
const ( // PublicKeySize is the size of a Curve25519 public key in bytes. PublicKeySize = 32 // PrivateKeySize is the size of a Curve25519 private key in bytes. PrivateKeySize = 32 SharedSecretSize = 32 )
Variables ¶
View Source
var ErrInvalidPublicKey = errors.New("kex: invalid raw public key")
ErrInvalidPublicKey is the error returned when a public key is invalid.
Functions ¶
func GenerateKey ¶
func GenerateKey(random io.Reader) (priv *PrivateKey, pub *PublicKey, err error)
GenerateKey creates a new public/private key pair using a given source of entropy.
Types ¶
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
PrivateKey is a wrapper type around a private key.
func (*PrivateKey) KeyExchange ¶
func (p *PrivateKey) KeyExchange(pub *PublicKey) *SharedSecret
KeyExchange calculates the shared secret based on a private key and separate public key.
func (*PrivateKey) Obliterate ¶
func (p *PrivateKey) Obliterate()
Obliterate clears the private key.
type PublicKey ¶
type PublicKey [PublicKeySize]byte
PublicKey is a wrapper type around a public key.
func NewPublicKey ¶
NewPublicKey creates a PublicKey from the raw key material.
type SharedSecret ¶
type SharedSecret [SharedSecretSize]byte
SharedSecret is a wrapper type around a shared secret.
func (*SharedSecret) Bytes ¶
func (s *SharedSecret) Bytes() []byte
Bytes returns the raw shared secret as a byte slice.
func (*SharedSecret) Obliterate ¶
func (s *SharedSecret) Obliterate()
Obliterate clears the shared secret.
Click to show internal directories.
Click to hide internal directories.