const ( // SeedSize is the length of the seed for NewKeyFromSeed SeedSize = ed448.SeedSize // > mode3.SeedSize // PublicKeySize is the length in bytes of the packed public key. PublicKeySize = mode3.PublicKeySize + ed448.PublicKeySize // PrivateKeySize is the length in bytes of the packed public key. PrivateKeySize = mode3.PrivateKeySize + ed448.SeedSize // SignatureSize is the length in bytes of the signatures. SignatureSize = mode3.SignatureSize + ed448.SignatureSize )
func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error)
GenerateKey generates a public/private key pair using entropy from rand. If rand is nil, crypto/rand.Reader will be used.
func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey)
NewKeyFromSeed derives a public/private key pair using the given seed.
func Scheme() sign.Scheme
Scheme returns a signature interface.
func SignTo(sk *PrivateKey, msg []byte, signature []byte)
SignTo signs the given message and writes the signature into signature. It will panic if signature is not of length at least SignatureSize.
func Verify(pk *PublicKey, msg []byte, signature []byte) bool
Verify checks whether the given signature by pk on msg is valid.
PrivateKey is the type of an EdDilithium3 private key.
type PrivateKey struct {
// contains filtered or unexported fields
}
func (sk *PrivateKey) Bytes() []byte
Bytes packs the private key.
func (sk *PrivateKey) Equal(other crypto.PrivateKey) bool
func (sk *PrivateKey) MarshalBinary() ([]byte, error)
MarshalBinary packs the private key.
func (sk *PrivateKey) Pack(buf *[PrivateKeySize]byte)
Pack packs the private key into buf.
func (sk *PrivateKey) Public() crypto.PublicKey
Public computes the public key corresponding to this private key.
Returns a *PublicKey. The type crypto.PublicKey is used to make PrivateKey implement the crypto.Signer interface.
func (sk *PrivateKey) Scheme() sign.Scheme
func (sk *PrivateKey) Sign( rand io.Reader, msg []byte, opts crypto.SignerOpts, ) (signature []byte, err error)
Sign signs the given message.
opts.HashFunc() must return zero, which can be achieved by passing crypto.Hash(0) for opts. rand is ignored. Will only return an error if opts.HashFunc() is non-zero.
This function is used to make PrivateKey implement the crypto.Signer interface. The package-level SignTo function might be more convenient to use.
func (sk *PrivateKey) UnmarshalBinary(data []byte) error
UnmarshalBinary unpacks the private key from data.
func (sk *PrivateKey) Unpack(buf *[PrivateKeySize]byte)
Unpack sets sk to the private key encoded in buf.
PublicKey is the type of an EdDilithium3 public key.
type PublicKey struct {
// contains filtered or unexported fields
}
func (pk *PublicKey) Bytes() []byte
Bytes packs the public key.
func (pk *PublicKey) Equal(other crypto.PublicKey) bool
func (pk *PublicKey) MarshalBinary() ([]byte, error)
MarshalBinary packs the public key.
func (pk *PublicKey) Pack(buf *[PublicKeySize]byte)
Pack packs the public key into buf.
func (pk *PublicKey) Scheme() sign.Scheme
func (pk *PublicKey) UnmarshalBinary(data []byte) error
UnmarshalBinary the public key from data.
func (pk *PublicKey) Unpack(buf *[PublicKeySize]byte)
Unpack unpacks pk to the public key encoded in buf.