pub struct DecapKey {
ml: DecapsulationKey,
ml_ek: EncapsulationKey,
ec: PrivateKey,
}Expand description
Decapsulation key, the ‘private key’ of the KEM. Generate using DecapKey::generate.
Fields§
§ml: DecapsulationKey§ml_ek: EncapsulationKeyCached ML-KEM encapsulation key.
The mlkem::DecapsulationKey type is a bit weird: it either contains just the
decapsulation key (when read from bytes via mlkem::DecapsulationKey::new or
it contains both an encapsulation and decapsulation key (when generated via
mlkem::DecapsulationKey::generate.)
So to deal with the former case, we include the encapsulation key here as well.
ec: PrivateKeyImplementations§
Source§impl DecapKey
impl DecapKey
Sourcepub fn decap(&self, ct: &CiphertextBytes) -> Result<SharedSecret, Opaque>
pub fn decap(&self, ct: &CiphertextBytes) -> Result<SharedSecret, Opaque>
Decapsulates ciphertext, recovering the SharedSecret within. Expensive.
Sourcepub fn encode(&self) -> Result<DecapKeyBytes, Opaque>
pub fn encode(&self) -> Result<DecapKeyBytes, Opaque>
Encodes for storage.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DecapKey
impl RefUnwindSafe for DecapKey
impl Send for DecapKey
impl Sync for DecapKey
impl Unpin for DecapKey
impl UnsafeUnpin for DecapKey
impl UnwindSafe for DecapKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more