Skip to main content

TryDecapsulate

Trait TryDecapsulate 

Source
pub trait TryDecapsulate: Decapsulator {
    type Error: Error;

    // Required method
    fn try_decapsulate(
        &self,
        ct: &Ciphertext<Self::Kem>,
    ) -> Result<SharedKey<Self::Kem>, Self::Error>;

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

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

Prefer to implement the Decapsulate trait if possible. See that trait’s documentation for more information.

Required Associated Types§

Source

type Error: Error

Decapsulation error

Required Methods§

Source

fn try_decapsulate( &self, ct: &Ciphertext<Self::Kem>, ) -> Result<SharedKey<Self::Kem>, Self::Error>

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

Provided Methods§

Source

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

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§