pub struct PrivateKey768(/* private fields */);Expand description
An ML-KEM-768 private key.
Implementations§
Source§impl PrivateKey768
impl PrivateKey768
Sourcepub fn generate() -> (Vec<u8>, PrivateKey768, [u8; 64])
pub fn generate() -> (Vec<u8>, PrivateKey768, [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) -> PublicKey768
pub fn to_public_key(&self) -> PublicKey768
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.