pub struct DecapsulationKey<P>where
P: KemParams,{ /* private fields */ }Expand description
A DecapsulationKey provides the ability to generate a new key pair, and decapsulate an
encapsulated shared key.
Implementations§
Source§impl<P> DecapsulationKey<P>where
P: KemParams,
impl<P> DecapsulationKey<P>where
P: KemParams,
Sourcepub fn from_seed(seed: Seed) -> Self
pub fn from_seed(seed: Seed) -> Self
Create a DecapsulationKey instance from a 64-byte random seed value.
Sourcepub fn to_seed(&self) -> Option<Seed>
pub fn to_seed(&self) -> Option<Seed>
Serialize the Seed value: 64-bytes which can be used to reconstruct the
DecapsulationKey.
§⚠️Warning!
This value is key material. Please treat it with care.
§Returns
Someif theDecapsulationKeywas initialized usingfrom_seedorgenerate.Noneif theDecapsulationKeywas initialized from the expanded form.
Sourcepub fn encapsulation_key(&self) -> &EncapsulationKey<P>
pub fn encapsulation_key(&self) -> &EncapsulationKey<P>
Get the EncapsulationKey which corresponds to this DecapsulationKey.
Trait Implementations§
Source§impl<P> AssociatedAlgorithmIdentifier for DecapsulationKey<P>where
P: KemParams + AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
Available on crate feature pkcs8 only.
impl<P> AssociatedAlgorithmIdentifier for DecapsulationKey<P>where
P: KemParams + AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
Available on crate feature
pkcs8 only.Source§const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = P::ALGORITHM_IDENTIFIER
const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = P::ALGORITHM_IDENTIFIER
AlgorithmIdentifier for this structure.Source§type Params = <P as AssociatedAlgorithmIdentifier>::Params
type Params = <P as AssociatedAlgorithmIdentifier>::Params
Algorithm parameters.
Source§impl<P> Clone for DecapsulationKey<P>where
P: KemParams + Clone,
impl<P> Clone for DecapsulationKey<P>where
P: KemParams + Clone,
Source§fn clone(&self) -> DecapsulationKey<P>
fn clone(&self) -> DecapsulationKey<P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P> Debug for DecapsulationKey<P>where
P: KemParams + Debug,
impl<P> Debug for DecapsulationKey<P>where
P: KemParams + Debug,
Source§impl<P> Decapsulate<Array<u8, <P as PkeParams>::CiphertextSize>, Array<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>> for DecapsulationKey<P>where
P: KemParams,
impl<P> Decapsulate<Array<u8, <P as PkeParams>::CiphertextSize>, Array<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>> for DecapsulationKey<P>where
P: KemParams,
Source§type Encapsulator = EncapsulationKey<P>
type Encapsulator = EncapsulationKey<P>
Encapsulator which corresponds to this decapsulator.
Source§type Error = Infallible
type Error = Infallible
Decapsulation error
Source§fn decapsulate(
&self,
encapsulated_key: &Array<u8, <P as PkeParams>::CiphertextSize>,
) -> Result<B32, Self::Error>
fn decapsulate( &self, encapsulated_key: &Array<u8, <P as PkeParams>::CiphertextSize>, ) -> Result<B32, Self::Error>
Decapsulates the given encapsulated key
Source§fn encapsulator(&self) -> EncapsulationKey<P>
fn encapsulator(&self) -> EncapsulationKey<P>
Retrieve the encapsulator associated with this decapsulator.
Source§impl<P> Drop for DecapsulationKey<P>where
P: KemParams,
Available on crate feature zeroize only.
impl<P> Drop for DecapsulationKey<P>where
P: KemParams,
Available on crate feature
zeroize only.Source§impl<P> EncodePrivateKey for DecapsulationKey<P>where
P: KemParams + AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
Available on crate features pkcs8 and alloc only.
impl<P> EncodePrivateKey for DecapsulationKey<P>where
P: KemParams + AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
Available on crate features
pkcs8 and alloc only.Source§fn to_pkcs8_der(&self) -> Result<SecretDocument>
fn to_pkcs8_der(&self) -> Result<SecretDocument>
Serialize the given DecapsulationKey into DER format.
Returns a SecretDocument which wraps the DER document in case of success.
Source§fn to_pkcs8_pem(
&self,
line_ending: LineEnding,
) -> Result<Zeroizing<String>, Error>
fn to_pkcs8_pem( &self, line_ending: LineEnding, ) -> Result<Zeroizing<String>, Error>
Serialize this private key as PEM-encoded PKCS#8 with the given
LineEnding.Source§impl<P> EncodedSizeUser for DecapsulationKey<P>where
P: KemParams,
impl<P> EncodedSizeUser for DecapsulationKey<P>where
P: KemParams,
Source§impl<P> From<Array<u8, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for DecapsulationKey<P>where
P: KemParams,
impl<P> From<Array<u8, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for DecapsulationKey<P>where
P: KemParams,
Source§impl<P> KeyInit for DecapsulationKey<P>where
P: KemParams,
impl<P> KeyInit for DecapsulationKey<P>where
P: KemParams,
Source§fn weak_key_test(_key: &Array<u8, Self::KeySize>) -> Result<(), WeakKeyError>
fn weak_key_test(_key: &Array<u8, Self::KeySize>) -> Result<(), WeakKeyError>
Check if the key might be considered weak.
Source§fn new_checked(key: &Array<u8, Self::KeySize>) -> Result<Self, WeakKeyError>
fn new_checked(key: &Array<u8, Self::KeySize>) -> Result<Self, WeakKeyError>
Create new value from fixed size key after checking it for weakness.
Source§fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
Create new value from variable size key.
Source§fn generate_key_with_rng<R>(rng: &mut R) -> Array<u8, Self::KeySize>
fn generate_key_with_rng<R>(rng: &mut R) -> Array<u8, Self::KeySize>
Generate random key using the provided
CryptoRng.Source§fn try_generate_key_with_rng<R>(
rng: &mut R,
) -> Result<Array<u8, Self::KeySize>, <R as TryRngCore>::Error>where
R: TryCryptoRng + ?Sized,
fn try_generate_key_with_rng<R>(
rng: &mut R,
) -> Result<Array<u8, Self::KeySize>, <R as TryRngCore>::Error>where
R: TryCryptoRng + ?Sized,
Generate random key using the provided
TryCryptoRng.Source§impl<P> KeySizeUser for DecapsulationKey<P>where
P: KemParams,
impl<P> KeySizeUser for DecapsulationKey<P>where
P: KemParams,
Source§impl<P> PartialEq for DecapsulationKey<P>where
P: KemParams,
impl<P> PartialEq for DecapsulationKey<P>where
P: KemParams,
Source§impl<P> TryFrom<PrivateKeyInfo<AnyRef<'_>, &OctetStringRef, BitStringRef<'_>>> for DecapsulationKey<P>where
P: KemParams + AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
Available on crate feature pkcs8 only.
impl<P> TryFrom<PrivateKeyInfo<AnyRef<'_>, &OctetStringRef, BitStringRef<'_>>> for DecapsulationKey<P>where
P: KemParams + AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
Available on crate feature
pkcs8 only.impl<P> ZeroizeOnDrop for DecapsulationKey<P>where
P: KemParams,
Available on crate feature
zeroize only.Auto Trait Implementations§
impl<P> Freeze for DecapsulationKey<P>
impl<P> RefUnwindSafe for DecapsulationKey<P>
impl<P> Send for DecapsulationKey<P>
impl<P> Sync for DecapsulationKey<P>
impl<P> Unpin for DecapsulationKey<P>
impl<P> UnwindSafe for DecapsulationKey<P>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<AnyRef<'a>, &'a OctetStringRef, BitStringRef<'a>>, Error = Error>,
impl<T> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<AnyRef<'a>, &'a OctetStringRef, BitStringRef<'a>>, Error = Error>,
Source§impl<T> DynAssociatedAlgorithmIdentifier for Twhere
T: AssociatedAlgorithmIdentifier,
impl<T> DynAssociatedAlgorithmIdentifier for Twhere
T: AssociatedAlgorithmIdentifier,
Source§fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier for this structure.