Documentation ¶
Overview ¶
Package curve25519 implements the XEd25519 signature scheme.
See https://signal.org/docs/specifications/xeddsa/#curve25519 for more information.
Index ¶
Constants ¶
const ( PrivateKeySize = 32 PublicKeySize = 32 SignatureSize = ed25519.SignatureSize )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey represents a Montgomery private key used for the XEdDSA scheme.
func GeneratePrivateKey ¶
func GeneratePrivateKey(random io.Reader) (*PrivateKey, error)
GeneratePrivateKey generates a random private key.
It is recommended to use a cryptographic random reader. If random is nil, then crypto/rand.Reader is used.
func NewPrivateKey ¶
func NewPrivateKey(key []byte) (*PrivateKey, error)
NewPrivateKey creates a new private key based on the given input.
func (*PrivateKey) Agreement ¶
func (p *PrivateKey) Agreement(key []byte) ([]byte, error)
Agreement computes the ECDH shared key between the private key and the given public key.
func (*PrivateKey) Bytes ¶
func (p *PrivateKey) Bytes() []byte
Bytes returns a copy of the private key.
func (*PrivateKey) PublicKeyBytes ¶
func (p *PrivateKey) PublicKeyBytes() []byte
PublicKeyBytes returns the public key in the form of a Montgomery u-point.
func (*PrivateKey) Sign ¶
Sign calculates an XEdDSA signature using the X25519 private key, directly.
The calculated signature is a valid ed25519 signature.
It is recommended to use a cryptographic random reader. If random is nil, then crypto/rand.Reader is used.