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§
Required Methods§
Sourcefn encapsulate_with_rng<R>(
&self,
rng: &mut R,
) -> (Ciphertext<Self::Kem>, SharedKey<Self::Kem>)
fn encapsulate_with_rng<R>( &self, rng: &mut R, ) -> (Ciphertext<Self::Kem>, SharedKey<Self::Kem>)
Encapsulates a fresh SharedKey generated using the supplied random number
generator R.
Provided Methods§
Sourcefn encapsulate(&self) -> (Ciphertext<Self::Kem>, SharedKey<Self::Kem>)
Available on crate feature getrandom only.
fn encapsulate(&self) -> (Ciphertext<Self::Kem>, SharedKey<Self::Kem>)
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.