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,
    ) -> (Ciphertext<Self::Kem>, SharedKey<Self::Kem>)
       where R: CryptoRng + ?Sized;

    // Provided method
    fn encapsulate(&self) -> (Ciphertext<Self::Kem>, SharedKey<Self::Kem>) { ... }
}
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, ) -> (Ciphertext<Self::Kem>, SharedKey<Self::Kem>)
where R: CryptoRng + ?Sized,

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

Provided Methods§

Source

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

Available on crate feature getrandom only.

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§