const ( // Size of seed for NewKeyFromSeed KeySeedSize = cpapke.KeySeedSize + 32 // Size of seed for EncapsulateTo. EncapsulationSeedSize = 32 // Size of the established shared key. = 32 // Size of the encapsulated shared key. CiphertextSize = cpapke.CiphertextSize // Size of a packed public key. PublicKeySize = cpapke.PublicKeySize // Size of a packed private key. PrivateKeySize = cpapke.PrivateKeySize + cpapke.PublicKeySize + 64 )
func GenerateKeyPair(rand io.Reader) (*PublicKey, *PrivateKey, error)
GenerateKeyPair generates public and private keys using entropy from rand. If rand is nil, crypto/rand.Reader will be used.
func NewKeyFromSeed(seed []byte) (*PublicKey, *PrivateKey)
NewKeyFromSeed derives a public/private keypair deterministically from the given seed.
Panics if seed is not of length KeySeedSize.
func Scheme() kem.Scheme
Scheme returns a KEM interface.
Type of a Kyber512.CCAKEM private key
type PrivateKey struct {
// contains filtered or unexported fields
}
func (sk *PrivateKey) DecapsulateTo(ss, ct []byte)
DecapsulateTo computes the shared key which is encapsulated in ct for the private key.
Panics if ct or ss are not of length CiphertextSize and SharedKeySize respectively.
func (sk *PrivateKey) Equal(other kem.PrivateKey) bool
func (sk *PrivateKey) MarshalBinary() ([]byte, error)
func (sk *PrivateKey) Pack(buf []byte)
Packs sk to buf.
Panics if buf is not of size PrivateKeySize.
func (sk *PrivateKey) Public() kem.PublicKey
func (sk *PrivateKey) Scheme() kem.Scheme
func (sk *PrivateKey) Unpack(buf []byte)
Unpacks sk from buf.
Panics if buf is not of size PrivateKeySize.
Type of a Kyber512.CCAKEM public key
type PublicKey struct {
// contains filtered or unexported fields
}
func (pk *PublicKey) EncapsulateTo(ct, ss []byte, seed []byte)
EncapsulateTo generates a shared key and ciphertext that contains it for the public key using randomness from seed and writes the shared key to ss and ciphertext to ct.
Panics if ss, ct or seed are not of length SharedKeySize, CiphertextSize and EncapsulationSeedSize respectively.
seed may be nil, in which case crypto/rand.Reader is used to generate one.
func (pk *PublicKey) Equal(other kem.PublicKey) bool
func (pk *PublicKey) MarshalBinary() ([]byte, error)
func (pk *PublicKey) Pack(buf []byte)
Packs pk to buf.
Panics if buf is not of size PublicKeySize.
func (pk *PublicKey) Scheme() kem.Scheme
func (pk *PublicKey) Unpack(buf []byte)
Unpacks pk from buf.
Panics if buf is not of size PublicKeySize.