#[non_exhaustive]pub enum Kdf<'a> {
Pbkdf2(Pbkdf2Params<'a>),
Scrypt(ScryptParams<'a>),
}Expand description
Password-based key derivation function.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Pbkdf2(Pbkdf2Params<'a>)
Password-Based Key Derivation Function 2 (PBKDF2).
Scrypt(ScryptParams<'a>)
scrypt sequential memory-hard password hashing function.
Implementations§
Source§impl<'a> Kdf<'a>
impl<'a> Kdf<'a>
Sourcepub fn key_length(&self) -> Option<u16>
pub fn key_length(&self) -> Option<u16>
Get derived key length in bytes, if defined.
Sourcepub fn oid(&self) -> ObjectIdentifier
pub fn oid(&self) -> ObjectIdentifier
Get the ObjectIdentifier (a.k.a OID) for this algorithm.
Sourcepub fn pbkdf2(&self) -> Option<&Pbkdf2Params<'a>>
pub fn pbkdf2(&self) -> Option<&Pbkdf2Params<'a>>
Get Pbkdf2Params if it is the selected algorithm.
Sourcepub fn scrypt(&self) -> Option<&ScryptParams<'a>>
pub fn scrypt(&self) -> Option<&ScryptParams<'a>>
Get ScryptParams if it is the selected algorithm.
Sourcepub fn to_alg_params_invalid(&self) -> Error
pub fn to_alg_params_invalid(&self) -> Error
Convenience function to turn the OID (see oid)
of this Kdf into error case Error::AlgorithmParametersInvalid
Trait Implementations§
Source§impl<'a> DecodeValue<'a> for Kdf<'a>
impl<'a> DecodeValue<'a> for Kdf<'a>
Source§impl EncodeValue for Kdf<'_>
impl EncodeValue for Kdf<'_>
Source§impl<'a> From<Pbkdf2Params<'a>> for Kdf<'a>
impl<'a> From<Pbkdf2Params<'a>> for Kdf<'a>
Source§fn from(params: Pbkdf2Params<'a>) -> Self
fn from(params: Pbkdf2Params<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<ScryptParams<'a>> for Kdf<'a>
impl<'a> From<ScryptParams<'a>> for Kdf<'a>
Source§fn from(params: ScryptParams<'a>) -> Self
fn from(params: ScryptParams<'a>) -> Self
Converts to this type from the input type.
impl<'a> Eq for Kdf<'a>
impl<'a> Sequence<'a> for Kdf<'a>
impl<'a> StructuralPartialEq for Kdf<'a>
Auto Trait Implementations§
impl<'a> Freeze for Kdf<'a>
impl<'a> RefUnwindSafe for Kdf<'a>
impl<'a> Send for Kdf<'a>
impl<'a> Sync for Kdf<'a>
impl<'a> Unpin for Kdf<'a>
impl<'a> UnsafeUnpin for Kdf<'a>
impl<'a> UnwindSafe for Kdf<'a>
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<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
Source§impl<T> Encode for Twhere
T: EncodeValue + Tagged,
impl<T> Encode for Twhere
T: EncodeValue + Tagged,
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
Source§fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided Writer.
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this value to the provided byte slice, returning a sub-slice
containing the encoded message.