Documentation ¶
Index ¶
Constants ¶
const ( EddsaPKLen = 32 EddsaVKLen = 64 EddsaSignLen = 64 )
length
const (
// SeedSize is the Size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.
SeedSize = 32
)
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
func GenerateKey(rand io.Reader) (*EDDSAPrivateKey, *EDDSAPublicKey)
GenerateKey generates a public/private key pair using entropy from rand. If rand is nil, crypto/rand.Reader will be used.
Types ¶
type EDDSAPrivateKey ¶
type EDDSAPrivateKey [EddsaVKLen]byte
EDDSAPrivateKey : 64[]byte
func (*EDDSAPrivateKey) Bytes ¶
func (key *EDDSAPrivateKey) Bytes() ([]byte, error)
Bytes return key bytes. Inverse method of FromBytes(k []byte, opt AlgorithmOption)
func (*EDDSAPrivateKey) FromBytes ¶
func (key *EDDSAPrivateKey) FromBytes(k []byte, opt int) error
FromBytes parse a private Key from bytes, Inverse method of Bytes()
func (*EDDSAPrivateKey) Public ¶
func (key *EDDSAPrivateKey) Public() crypto.PublicKey
Public Get EDDSAPublicKey from a EDDSAPrivateKey, if EDDSAPublicKey is empty, this method will invoke CalculatePublicKey().
func (*EDDSAPrivateKey) Sign ¶
Sign signs the given message with priv. rand is ignored. If opts.HashFunc() is crypto.SHA512, the pre-hashed variant Ed25519ph is used and message is expected to be a SHA-512 hash, otherwise opts.HashFunc() must be crypto.Hash(0) and the message must not be hashed, as Ed25519 performs two passes over messages to be signed.
type EDDSAPublicKey ¶
type EDDSAPublicKey [EddsaPKLen]byte
EDDSAPublicKey :32[]byte
func (*EDDSAPublicKey) Bytes ¶
func (key *EDDSAPublicKey) Bytes() ([]byte, error)
Bytes return key bytes
type ExtendedGroupElement ¶
ExtendedGroupElement ge25519