Skip to main content

Decapsulate

Trait Decapsulate 

Source
pub trait Decapsulate: TryDecapsulate<Error = Infallible> {
    // Required method
    fn decapsulate(
        &self,
        ct: &Array<u8, <Self::Kem as Kem>::CiphertextSize>,
    ) -> Array<u8, <Self::Kem as Kem>::SharedKeySize>;

    // Provided method
    fn decapsulate_slice(
        &self,
        ct: &[u8],
    ) -> Result<Array<u8, <Self::Kem as Kem>::SharedKeySize>, 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: &Array<u8, <Self::Kem as Kem>::CiphertextSize>, ) -> Array<u8, <Self::Kem as Kem>::SharedKeySize>

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

Provided Methods§

Source

fn decapsulate_slice( &self, ct: &[u8], ) -> Result<Array<u8, <Self::Kem as Kem>::SharedKeySize>, 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§

Source§

impl<P> Decapsulate for DecapsulationKey<P>
where P: Kem<EncapsulationKey = EncapsulationKey<P>, SharedKeySize = U32> + KemParams,