pub struct CompressedDecapsulationKey(/* private fields */);Expand description
Compressed form of the decapsulation key (32-byte seed).
Since keypair generation from a seed is deterministic, the seed
is sufficient to reconstruct the full DecapsulationKey (and its
corresponding EncapsulationKey). This reduces storage from
1763 bytes to 32 bytes.
Security: The seed is equivalent to the full secret key. It must be kept secret and protected with the same care. Zeroized on drop.
Implementations§
Source§impl CompressedDecapsulationKey
impl CompressedDecapsulationKey
Sourcepub fn generate(rng: impl CryptoRng) -> Self
pub fn generate(rng: impl CryptoRng) -> Self
Generates a random compressed decapsulation key.
§Example
use sntrup761::*;
let csk = CompressedDecapsulationKey::generate(rand::rng());
let (pk, sk) = csk.expand();Sourcepub fn expand(&self) -> (EncapsulationKey, DecapsulationKey)
pub fn expand(&self) -> (EncapsulationKey, DecapsulationKey)
Expands this seed into the full keypair.
Source§impl CompressedDecapsulationKey
impl CompressedDecapsulationKey
Sourcepub fn decapsulate(&self, cstr: &Ciphertext) -> SharedSecret
pub fn decapsulate(&self, cstr: &Ciphertext) -> SharedSecret
Convenience: expands the key and decapsulates in one step.
This recomputes the full decapsulation key each time.
If decapsulating multiple ciphertexts, use expand
once and call DecapsulationKey::decapsulate on each.
Trait Implementations§
Source§impl AsRef<[u8]> for CompressedDecapsulationKey
impl AsRef<[u8]> for CompressedDecapsulationKey
Source§impl Clone for CompressedDecapsulationKey
impl Clone for CompressedDecapsulationKey
Source§fn clone(&self) -> CompressedDecapsulationKey
fn clone(&self) -> CompressedDecapsulationKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompressedDecapsulationKey
impl Debug for CompressedDecapsulationKey
Source§impl Drop for CompressedDecapsulationKey
impl Drop for CompressedDecapsulationKey
Source§impl TryFrom<&[u8]> for CompressedDecapsulationKey
impl TryFrom<&[u8]> for CompressedDecapsulationKey
Source§impl Zeroize for CompressedDecapsulationKey
impl Zeroize for CompressedDecapsulationKey
impl Eq for CompressedDecapsulationKey
Auto Trait Implementations§
impl Freeze for CompressedDecapsulationKey
impl RefUnwindSafe for CompressedDecapsulationKey
impl Send for CompressedDecapsulationKey
impl Sync for CompressedDecapsulationKey
impl Unpin for CompressedDecapsulationKey
impl UnsafeUnpin for CompressedDecapsulationKey
impl UnwindSafe for CompressedDecapsulationKey
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