Documentation ¶
Overview ¶
Package x25519 implements Elliptic Curve Diffie-Hellman (ECDH) function over Curve25519. Details at https://cr.yp.to/ecdh.html and https://tools.ietf.org/html/rfc7748
Index ¶
Constants ¶
const KeySize = 32
KeySize is the size of keys in bytes used in this package.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey is the type of Curve25519 secret keys.
func GenerateKey ¶
GenerateKey generates a secret key using entropy from random, or crypto/rand.Reader if random is nil.
func GenerateKeyUniform ¶
GenerateKeyUniform generates a secret key whose corresponding public key has a uniform representative using entropy from random, or crypto/rand.Reader if random is nil.
func NewSecretKey ¶
NewSecretKey creates a SecretKey from byte slice sk and len(sk) must be 32.
func (*SecretKey) PublicUniform ¶
func (k *SecretKey) PublicUniform() UniformRepresentative
PublicUniform returns the uniform representative of the public key corresponding to the secret key, or nil if the public key does not have a uniform representative.
func (*SecretKey) Shared ¶
Shared computes the shared secret between our secret key and peer's public key.
func (*SecretKey) SharedUniform ¶
func (k *SecretKey) SharedUniform(peer UniformRepresentative) []byte
SharedUniform computes the shared secret between our secret key and peer public key's uniform representative.
type UniformRepresentative ¶
type UniformRepresentative []byte
UniformRepresentative is the type of Curve25519 public key uniform representatives. See https://www.imperialviolet.org/2013/12/25/elligator.html
func (UniformRepresentative) Public ¶
func (u UniformRepresentative) Public() PublicKey
Public returns the curve25519 public key corresponding to the uniform presentative.