pub struct PrivateKey1024(/* private fields */);Expand description
An ML-KEM-1024 private key.
Use ML-KEM-768 unless you have a good reason to need this larger size.
Implementations§
Source§impl PrivateKey1024
impl PrivateKey1024
Sourcepub fn generate() -> (Vec<u8>, PrivateKey1024, [u8; 64])
pub fn generate() -> (Vec<u8>, PrivateKey1024, [u8; 64])
Generates a random public/private key pair returning a serialized public key, a private key, and a private seed value that can be used to regenerate the same private key in the future.
Sourcepub fn to_public_key(&self) -> PublicKey1024
pub fn to_public_key(&self) -> PublicKey1024
Derives the public key corresponding to this private key.
Sourcepub fn decapsulate(&self, ciphertext: &[u8]) -> Option<[u8; 32]>
pub fn decapsulate(&self, ciphertext: &[u8]) -> Option<[u8; 32]>
Decapsulates a shared secret from a ciphertext. This function only
returns None if ciphertext is the wrong length. For invalid
ciphertexts it returns a key that will always be the same for the
same ciphertext and private key, but which appears to be random
unless one has access to the private key. These alternatives occur in
constant time. Any subsequent symmetric encryption using the result
must use an authenticated encryption scheme in order to discover the
decapsulation failure.