package mlkem
Import Path
crypto/internal/fips140/mlkem (on go.dev)
Dependency Relation
imports 8 packages, and imported by 2 packages
Involved Source Files
cast.go
field.go
mlkem1024.go
Package mlkem implements the quantum-resistant key encapsulation method
ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203].
Package-Level Type Names (total 4)
A DecapsulationKey1024 is the secret key used to decapsulate a shared key from a
ciphertext. It includes various precomputed values.
Bytes returns the decapsulation key as a 64-byte seed in the "d || z" form.
The decapsulation key must be kept secret.
Decapsulate generates a shared key from a ciphertext and a decapsulation key.
If the ciphertext is not valid, Decapsulate returns an error.
The shared key must be kept secret.
EncapsulationKey returns the public encapsulation key necessary to produce
ciphertexts.
func GenerateKey1024() (*DecapsulationKey1024, error)
func GenerateKeyInternal1024(d, z *[32]byte) *DecapsulationKey1024
func NewDecapsulationKey1024(seed []byte) (*DecapsulationKey1024, error)
A DecapsulationKey768 is the secret key used to decapsulate a shared key from a
ciphertext. It includes various precomputed values.
Bytes returns the decapsulation key as a 64-byte seed in the "d || z" form.
The decapsulation key must be kept secret.
Decapsulate generates a shared key from a ciphertext and a decapsulation key.
If the ciphertext is not valid, Decapsulate returns an error.
The shared key must be kept secret.
EncapsulationKey returns the public encapsulation key necessary to produce
ciphertexts.
func GenerateKey768() (*DecapsulationKey768, error)
func GenerateKeyInternal768(d, z *[32]byte) *DecapsulationKey768
func NewDecapsulationKey768(seed []byte) (*DecapsulationKey768, error)
An EncapsulationKey1024 is the public key used to produce ciphertexts to be
decapsulated by the corresponding [DecapsulationKey1024].
Bytes returns the encapsulation key as a byte slice.
Encapsulate generates a shared key and an associated ciphertext from an
encapsulation key, drawing random bytes from a DRBG.
The shared key must be kept secret.
EncapsulateInternal is a derandomized version of Encapsulate, exclusively for
use in tests.
func NewEncapsulationKey1024(encapsulationKey []byte) (*EncapsulationKey1024, error)
func (*DecapsulationKey1024).EncapsulationKey() *EncapsulationKey1024
An EncapsulationKey768 is the public key used to produce ciphertexts to be
decapsulated by the corresponding [DecapsulationKey768].
Bytes returns the encapsulation key as a byte slice.
Encapsulate generates a shared key and an associated ciphertext from an
encapsulation key, drawing random bytes from a DRBG.
The shared key must be kept secret.
EncapsulateInternal is a derandomized version of Encapsulate, exclusively for
use in tests.
func NewEncapsulationKey768(encapsulationKey []byte) (*EncapsulationKey768, error)
func (*DecapsulationKey768).EncapsulationKey() *EncapsulationKey768
Package-Level Functions (total 8)
GenerateKey1024 generates a new decapsulation key, drawing random bytes from
a DRBG. The decapsulation key must be kept secret.
GenerateKey768 generates a new decapsulation key, drawing random bytes from
a DRBG. The decapsulation key must be kept secret.
GenerateKeyInternal1024 is a derandomized version of GenerateKey1024,
exclusively for use in tests.
GenerateKeyInternal768 is a derandomized version of GenerateKey768,
exclusively for use in tests.
NewDecapsulationKey1024 parses a decapsulation key from a 64-byte
seed in the "d || z" form. The seed must be uniformly random.
NewDecapsulationKey768 parses a decapsulation key from a 64-byte
seed in the "d || z" form. The seed must be uniformly random.
NewEncapsulationKey1024 parses an encapsulation key from its encoded form.
If the encapsulation key is not valid, NewEncapsulationKey1024 returns an error.
NewEncapsulationKey768 parses an encapsulation key from its encoded form.
If the encapsulation key is not valid, NewEncapsulationKey768 returns an error.
Package-Level Constants (total 6)
ML-KEM-1024 parameters.
ML-KEM-768 parameters.
ML-KEM-1024 parameters.
ML-KEM-768 parameters.
const SeedSize = 64
The pages are generated with Golds v0.7.3-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |