Skip to main content

Encapsulate

Trait Encapsulate 

Source
pub trait Encapsulate: TryKeyInit + KeyExport {
    type Kem: Kem;

    // Required method
    fn encapsulate_with_rng<R>(
        &self,
        rng: &mut R,
    ) -> (Array<u8, <Self::Kem as Kem>::CiphertextSize>, Array<u8, <Self::Kem as Kem>::SharedKeySize>)
       where R: CryptoRng + ?Sized;

    // Provided method
    fn encapsulate(
        &self,
    ) -> (Array<u8, <Self::Kem as Kem>::CiphertextSize>, Array<u8, <Self::Kem as Kem>::SharedKeySize>) { ... }
}
Expand description

Encapsulator for shared secrets.

Often, this will just be a public key. However, it can also be a bundle of public keys, or it can include a sender’s private key for authenticated encapsulation.

Required Associated Types§

Source

type Kem: Kem

KEM algorithm this encapsulator is for.

Required Methods§

Source

fn encapsulate_with_rng<R>( &self, rng: &mut R, ) -> (Array<u8, <Self::Kem as Kem>::CiphertextSize>, Array<u8, <Self::Kem as Kem>::SharedKeySize>)
where R: CryptoRng + ?Sized,

Encapsulates a fresh SharedKey generated using the supplied random number generator R.

Provided Methods§

Source

fn encapsulate( &self, ) -> (Array<u8, <Self::Kem as Kem>::CiphertextSize>, Array<u8, <Self::Kem as Kem>::SharedKeySize>)

Encapsulate a fresh shared secret generated using the system’s secure RNG.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§