pub struct EncapsulationKey { /* private fields */ }Expand description
An ML-KEM-1024 encapsulation (public) key.
Implementations§
Source§impl EncapsulationKey
impl EncapsulationKey
Sourcepub fn from_bytes(ek_bytes: &[u8]) -> Result<Self>
pub fn from_bytes(ek_bytes: &[u8]) -> Result<Self>
Constructs an encapsulation key from its
MLKEM1024_ENCAPSULATION_KEY_SIZE-byte encoded form. Rejects
non-canonical encodings (any coefficient >= q).
Sourcepub fn encapsulate(&self) -> Result<(Zeroizing<[u8; 32]>, [u8; 1568])>
pub fn encapsulate(&self) -> Result<(Zeroizing<[u8; 32]>, [u8; 1568])>
Produces a fresh (shared_key, ciphertext) pair using system
randomness for the encapsulated message.
Sourcepub fn encapsulate_deterministic(
&self,
m: &[u8; 32],
) -> (Zeroizing<[u8; 32]>, [u8; 1568])
pub fn encapsulate_deterministic( &self, m: &[u8; 32], ) -> (Zeroizing<[u8; 32]>, [u8; 1568])
Derandomized counterpart to EncapsulationKey::encapsulate that takes
the 32-byte message m explicitly.
Test-only. Reusing m across encapsulations breaks IND-CCA
security; this exists solely to reproduce ACVP / Wycheproof /
cross-verification vectors. Production code must call
EncapsulationKey::encapsulate.
Trait Implementations§
Source§impl Clone for EncapsulationKey
impl Clone for EncapsulationKey
Source§fn clone(&self) -> EncapsulationKey
fn clone(&self) -> EncapsulationKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EncapsulationKey
impl RefUnwindSafe for EncapsulationKey
impl Send for EncapsulationKey
impl Sync for EncapsulationKey
impl Unpin for EncapsulationKey
impl UnsafeUnpin for EncapsulationKey
impl UnwindSafe for EncapsulationKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more