Documentation
¶
Overview ¶
Package mldsa implements ML-DSA (Module-Lattice-Based Digital Signature Algorithm) using Cloudflare's circl library with automatic CGO optimizations when available.
Index ¶
Constants ¶
const ( MLDSA44PublicKeySize = mldsa44.PublicKeySize MLDSA44PrivateKeySize = mldsa44.PrivateKeySize MLDSA44SignatureSize = mldsa44.SignatureSize MLDSA65PublicKeySize = mldsa65.PublicKeySize MLDSA65PrivateKeySize = mldsa65.PrivateKeySize MLDSA65SignatureSize = mldsa65.SignatureSize MLDSA87PublicKeySize = mldsa87.PublicKeySize MLDSA87PrivateKeySize = mldsa87.PrivateKeySize MLDSA87SignatureSize = mldsa87.SignatureSize )
Size constants for each mode
Variables ¶
Functions ¶
func GetPublicKeySize ¶ added in v1.4.18
GetPublicKeySize returns the size of a public key for the given mode
func GetSignatureSize ¶ added in v1.4.18
GetSignatureSize returns the size of a signature for the given mode
Types ¶
type PrivateKey ¶
type PrivateKey struct {
PublicKey *PublicKey
// contains filtered or unexported fields
}
PrivateKey represents an ML-DSA private key
func GenerateKey ¶
func GenerateKey(rand io.Reader, mode Mode) (*PrivateKey, error)
GenerateKey generates a new ML-DSA key pair using circl
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(mode Mode, data []byte) (*PrivateKey, error)
PrivateKeyFromBytes deserializes a private key
func (*PrivateKey) Bytes ¶
func (priv *PrivateKey) Bytes() []byte
Bytes returns the serialized private key
func (*PrivateKey) Public ¶ added in v1.4.18
func (priv *PrivateKey) Public() crypto.PublicKey
Public returns the public key
func (*PrivateKey) Sign ¶
func (priv *PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error)
Sign signs a message with the private key using circl
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey represents an ML-DSA public key
func PublicKeyFromBytes ¶
PublicKeyFromBytes deserializes a public key
func (*PublicKey) Verify ¶
func (pub *PublicKey) Verify(message, signature []byte, opts crypto.SignerOpts) bool
Verify verifies a signature with the public key using circl The opts parameter is ignored but kept for crypto.Signer interface compatibility
func (*PublicKey) VerifySignature ¶ added in v1.4.18
VerifySignature verifies a signature with the public key (simplified API)