Documentation ¶
Overview ¶
Package kem provides a unified interface for KEM schemes.
A register of schemes is available in the package
github.com/katzenpost/hpqc/kem/schemes
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTypeMismatch is the error used if types of, for instance, private // and public keys don't match ErrTypeMismatch = errors.New("types mismatch") // ErrSeedSize is the error used if the provided seed is of the wrong // size. ErrSeedSize = errors.New("wrong seed size") // ErrPubKeySize is the error used if the provided public key is of // the wrong size. ErrPubKeySize = errors.New("wrong size for public key") // ErrCiphertextSize is the error used if the provided ciphertext // is of the wrong size. ErrCiphertextSize = errors.New("wrong size for ciphertext") // ErrPrivKeySize is the error used if the provided private key is of // the wrong size. ErrPrivKeySize = errors.New("wrong size for private key") // ErrPubKey is the error used if the provided public key is invalid. ErrPubKey = errors.New("invalid public key") // ErrCipherText is the error used if the provided ciphertext is invalid. ErrCipherText = errors.New("invalid ciphertext") )
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey interface { encoding.BinaryMarshaler // Returns the scheme for this private key Scheme() Scheme // Equal returns true if the two keys are equal. Equal(PrivateKey) bool // Public returns the public key related to this private key. Public() PublicKey }
A KEM private key
type PublicKey ¶
type PublicKey interface { encoding.TextMarshaler encoding.BinaryMarshaler // Returns the scheme for this public key Scheme() Scheme Equal(PublicKey) bool }
A KEM public key
type Scheme ¶
type Scheme interface { // Name of the scheme Name() string // GenerateKeyPair creates a new key pair. GenerateKeyPair() (PublicKey, PrivateKey, error) // Encapsulate generates a shared key ss for the public key and // encapsulates it into a ciphertext ct. Encapsulate(pk PublicKey) (ct, ss []byte, err error) // Returns the shared key encapsulated in ciphertext ct for the // private key sk. Decapsulate(sk PrivateKey, ct []byte) ([]byte, error) // UnmarshalBinaryPublicKey unmarshals a PublicKey from the provided buffer. UnmarshalBinaryPublicKey([]byte) (PublicKey, error) // UnmarshalBinaryPrivateKey unmarshals a PrivateKey from the provided buffer. UnmarshalBinaryPrivateKey([]byte) (PrivateKey, error) // UnmarshalTextPublicKey unmarshals a PublicKey from the provided text. UnmarshalTextPublicKey([]byte) (PublicKey, error) // UnmarshalTextPrivateKey unmarshals a PrivateKey from the provided text. UnmarshalTextPrivateKey([]byte) (PrivateKey, error) // Size of encapsulated keys. CiphertextSize() int SharedKeySize() int // Size of packed private keys. PrivateKeySize() int // Size of packed public keys. PublicKeySize() int // DeriveKeyPair deterministicallly derives a pair of keys from a seed. // Panics if the length of seed is not equal to the value returned by // SeedSize. DeriveKeyPair(seed []byte) (PublicKey, PrivateKey) // Size of seed used in DeriveKey SeedSize() int }
A Scheme represents a specific instance of a KEM.
Directories ¶
Path | Synopsis |
---|---|
Package adapter provides an adhoc hashed ElGamal construction that essentially acts like an adapter, adapting a NIKE to KEM.
|
Package adapter provides an adhoc hashed ElGamal construction that essentially acts like an adapter, adapting a NIKE to KEM. |
Package combiner defines a security preserving KEM combiner.
|
Package combiner defines a security preserving KEM combiner. |
Package mlkem768 provides a KEM wrapper that uses our KEM interfaces.
|
Package mlkem768 provides a KEM wrapper that uses our KEM interfaces. |
This package provide the Streamlined NTRU Prime KEM.
|
This package provide the Streamlined NTRU Prime KEM. |
Package xwing provides the xwing KEM using a KEM wrapper so that it obeys our KEM interfaces for Scheme, PrivateKey, PublicKey.
|
Package xwing provides the xwing KEM using a KEM wrapper so that it obeys our KEM interfaces for Scheme, PrivateKey, PublicKey. |
Click to show internal directories.
Click to hide internal directories.