const ( // Size of seed for NewKeyFromSeed KeySeedSize = internal.SeedSize // Size of seed for EncryptTo EncryptionSeedSize = internal.SeedSize // Size of a packed PublicKey PublicKeySize = internal.PublicKeySize // Size of a packed PrivateKey PrivateKeySize = internal.PrivateKeySize // Size of a ciphertext CiphertextSize = internal.CiphertextSize // Size of a plaintext PlaintextSize = internal.PlaintextSize )
func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error)
GenerateKey generates a public/private key pair 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 key pair using the given seed.
Panics if seed is not of length KeySeedSize.
PrivateKey is the type of Kyber1024.CPAPKE private key
type PrivateKey internal.PrivateKey
func (sk *PrivateKey) DecryptTo(pt []byte, ct []byte)
DecryptTo decrypts message ct for the private key and writes the plaintext to pt.
This function panics if the lengths of ct and pt are not CiphertextSize and PlaintextSize respectively.
func (sk *PrivateKey) Equal(other *PrivateKey) bool
Returns whether the two private keys are equal.
func (sk *PrivateKey) Pack(buf []byte)
Packs sk into the given buffer.
Panics if buf is not of length PrivateKeySize.
func (sk *PrivateKey) Unpack(buf []byte)
Unpacks sk from the given buffer.
Panics if buf is not of length PrivateKeySize.
PublicKey is the type of Kyber1024.CPAPKE public key
type PublicKey internal.PublicKey
func (pk *PublicKey) EncryptTo(ct []byte, pt []byte, seed []byte)
EncryptTo encrypts message pt for the public key and writes the ciphertext to ct using randomness from seed.
This function panics if the lengths of pt, seed, and ct are not PlaintextSize, EncryptionSeedSize, and CiphertextSize respectively.
func (pk *PublicKey) Pack(buf []byte)
Packs pk into the given buffer.
Panics if buf is not of length PublicKeySize.
func (pk *PublicKey) Unpack(buf []byte)
Unpacks pk from the given buffer.
Panics if buf is not of length PublicKeySize.
Name | Synopsis |
---|---|
.. |