package mldsa
import "crypto/internal/fips140/mldsa"
Index
- Constants
- func Sign(priv *PrivateKey, msg []byte, context string) ([]byte, error)
- func SignDeterministic(priv *PrivateKey, msg []byte, context string) ([]byte, error)
- func SignExternalMu(priv *PrivateKey, μ []byte) ([]byte, error)
- func SignExternalMuDeterministic(priv *PrivateKey, μ []byte) ([]byte, error)
- func TestingOnlyPrivateKeySemiExpandedBytes(priv *PrivateKey) []byte
- func TestingOnlySignExternalMuWithRandom(priv *PrivateKey, μ []byte, random []byte) ([]byte, error)
- func TestingOnlySignWithRandom(priv *PrivateKey, msg []byte, context string, random []byte) ([]byte, error)
- func Verify(pub *PublicKey, msg, sig []byte, context string) error
- func VerifyExternalMu(pub *PublicKey, μ []byte, sig []byte) error
-
type PrivateKey
- func GenerateKey44() *PrivateKey
- func GenerateKey65() *PrivateKey
- func GenerateKey87() *PrivateKey
- func NewPrivateKey44(seed []byte) (*PrivateKey, error)
- func NewPrivateKey65(seed []byte) (*PrivateKey, error)
- func NewPrivateKey87(seed []byte) (*PrivateKey, error)
- func TestingOnlyNewPrivateKeyFromSemiExpanded(sk []byte) (*PrivateKey, error)
- func (priv *PrivateKey) Bytes() []byte
- func (priv *PrivateKey) Equal(x *PrivateKey) bool
- func (priv *PrivateKey) PublicKey() *PublicKey
- type PublicKey
Constants
const ( R = 4294967296 // 2³² RR = 2365951 // R² mod q, aka R in the Montgomery domain )
const ( PrivateKeySize = 32 PublicKeySize44 = 32 + 4*n*10/8 PublicKeySize65 = 32 + 6*n*10/8 PublicKeySize87 = 32 + 8*n*10/8 SignatureSize44 = 128/4 + 4*n*(17+1)/8 + 80 + 4 SignatureSize65 = 192/4 + 5*n*(19+1)/8 + 55 + 6 SignatureSize87 = 256/4 + 7*n*(19+1)/8 + 75 + 8 )
Functions
func Sign
func Sign(priv *PrivateKey, msg []byte, context string) ([]byte, error)
func SignDeterministic
func SignDeterministic(priv *PrivateKey, msg []byte, context string) ([]byte, error)
func SignExternalMu
func SignExternalMu(priv *PrivateKey, μ []byte) ([]byte, error)
func SignExternalMuDeterministic
func SignExternalMuDeterministic(priv *PrivateKey, μ []byte) ([]byte, error)
func TestingOnlyPrivateKeySemiExpandedBytes
func TestingOnlyPrivateKeySemiExpandedBytes(priv *PrivateKey) []byte
func TestingOnlySignExternalMuWithRandom
func TestingOnlySignExternalMuWithRandom(priv *PrivateKey, μ []byte, random []byte) ([]byte, error)
func TestingOnlySignWithRandom
func TestingOnlySignWithRandom(priv *PrivateKey, msg []byte, context string, random []byte) ([]byte, error)
func Verify
func Verify(pub *PublicKey, msg, sig []byte, context string) error
func VerifyExternalMu
func VerifyExternalMu(pub *PublicKey, μ []byte, sig []byte) error
Types
type PrivateKey
type PrivateKey struct { // contains filtered or unexported fields }
func GenerateKey44
func GenerateKey44() *PrivateKey
func GenerateKey65
func GenerateKey65() *PrivateKey
func GenerateKey87
func GenerateKey87() *PrivateKey
func NewPrivateKey44
func NewPrivateKey44(seed []byte) (*PrivateKey, error)
func NewPrivateKey65
func NewPrivateKey65(seed []byte) (*PrivateKey, error)
func NewPrivateKey87
func NewPrivateKey87(seed []byte) (*PrivateKey, error)
func TestingOnlyNewPrivateKeyFromSemiExpanded
func TestingOnlyNewPrivateKeyFromSemiExpanded(sk []byte) (*PrivateKey, error)
TestingOnlyNewPrivateKeyFromSemiExpanded creates a PrivateKey from a semi-expanded private key encoding, for testing purposes. It rejects inconsistent keys.
PrivateKey.Bytes must NOT be called on the resulting key, as it will produce a random value.
func (*PrivateKey) Bytes
func (priv *PrivateKey) Bytes() []byte
func (*PrivateKey) Equal
func (priv *PrivateKey) Equal(x *PrivateKey) bool
func (*PrivateKey) PublicKey
func (priv *PrivateKey) PublicKey() *PublicKey
type PublicKey
type PublicKey struct { // contains filtered or unexported fields }
func NewPublicKey44
func NewPublicKey44(pk []byte) (*PublicKey, error)
func NewPublicKey65
func NewPublicKey65(pk []byte) (*PublicKey, error)
func NewPublicKey87
func NewPublicKey87(pk []byte) (*PublicKey, error)
func (*PublicKey) Bytes
func (pub *PublicKey) Bytes() []byte
func (*PublicKey) Equal
func (pub *PublicKey) Equal(x *PublicKey) bool
func (*PublicKey) Parameters
func (pub *PublicKey) Parameters() string