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§
Required Methods§
Sourcefn try_decapsulate(
&self,
ct: &Ciphertext<Self::Kem>,
) -> Result<SharedKey<Self::Kem>, Self::Error>
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§
Sourcefn try_decapsulate_slice(
&self,
ct: &[u8],
) -> Result<SharedKey<Self::Kem>, Self::Error>
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
ctis not equal to<Self as Kem>::CiphertextSize.