Skip to main content

Decapsulate

Trait Decapsulate 

Source
pub trait Decapsulate: TryDecapsulate<Error = Infallible> {
    // Required method
    fn decapsulate(&self, ct: &Ciphertext<Self::Kem>) -> SharedKey<Self::Kem>;

    // Provided method
    fn decapsulate_slice(
        &self,
        ct: &[u8],
    ) -> Result<SharedKey<Self::Kem>, TryFromSliceError> { ... }
}
Expand description

Decapsulator for encapsulated keys, with an associated Encapsulator bounded by the Encapsulate trait.

Often, this will just be a secret key. But, as with Encapsulate, it can be a bundle of secret keys, or it can include a sender’s private key for authenticated encapsulation. It could also be a hardware device like an HSM, TPM, or SEP.

When possible (i.e. for software / non-HSM implementations) types which impl this trait should also impl the Generate trait to support key generation.

Required Methods§

Source

fn decapsulate(&self, ct: &Ciphertext<Self::Kem>) -> SharedKey<Self::Kem>

Decapsulates the given Ciphertext a.k.a. “encapsulated key”.

Provided Methods§

Source

fn decapsulate_slice( &self, ct: &[u8], ) -> Result<SharedKey<Self::Kem>, TryFromSliceError>

Decapsulate the given byte slice containing a Ciphertext a.k.a. “encapsulated key”.

§Errors
  • If the length of ct is not equal to <Self as Kem>::CiphertextSize.

Implementors§