pub struct DecapsulationKey<Id = AlgorithmId>where
Id: AlgorithmIdentifier,{ /* private fields */ }
Expand description
A serializable decapulsation key usable with KEMs. This can be randomly generated with DecapsulationKey::generate
.
Implementations§
Source§impl<Id> DecapsulationKey<Id>where
Id: AlgorithmIdentifier,
impl<Id> DecapsulationKey<Id>where
Id: AlgorithmIdentifier,
Sourcepub fn generate(alg: &'static Algorithm<Id>) -> Result<Self, Unspecified>
pub fn generate(alg: &'static Algorithm<Id>) -> Result<Self, Unspecified>
Generate a new KEM decapsulation key for the given algorithm.
§Errors
error::Unspecified
when operation fails due to internal error.
Sourcepub fn algorithm(&self) -> &'static Algorithm<Id>
pub fn algorithm(&self) -> &'static Algorithm<Id>
Return the algorithm associated with the given KEM decapsulation key.
Sourcepub fn encapsulation_key(&self) -> Result<EncapsulationKey<Id>, Unspecified>
pub fn encapsulation_key(&self) -> Result<EncapsulationKey<Id>, Unspecified>
Computes the KEM encapsulation key from the KEM decapsulation key.
§Errors
error::Unspecified
when operation fails due to internal error.
Sourcepub fn decapsulate(
&self,
ciphertext: Ciphertext<'_>,
) -> Result<SharedSecret, Unspecified>
pub fn decapsulate( &self, ciphertext: Ciphertext<'_>, ) -> Result<SharedSecret, Unspecified>
Performs the decapsulate operation using this KEM decapsulation key on the given ciphertext.
ciphertext
is the ciphertext generated by the encapsulate operation using the KEM encapsulation key
associated with this KEM decapsulation key.
§Errors
Unspecified
when operation fails due to internal error.
Trait Implementations§
Source§impl<Id> Debug for DecapsulationKey<Id>where
Id: AlgorithmIdentifier,
impl<Id> Debug for DecapsulationKey<Id>where
Id: AlgorithmIdentifier,
impl<Id> Send for DecapsulationKey<Id>where
Id: AlgorithmIdentifier,
impl<Id> Sync for DecapsulationKey<Id>where
Id: AlgorithmIdentifier,
Auto Trait Implementations§
impl<Id> Freeze for DecapsulationKey<Id>
impl<Id> RefUnwindSafe for DecapsulationKey<Id>where
Id: RefUnwindSafe,
impl<Id> Unpin for DecapsulationKey<Id>
impl<Id> UnwindSafe for DecapsulationKey<Id>where
Id: RefUnwindSafe,
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