pub struct Pbkdf2Params {
pub salt: Salt,
pub iteration_count: u32,
pub key_length: Option<u16>,
pub prf: Pbkdf2Prf,
}Expand description
Password-Based Key Derivation Scheme 2 parameters as defined in RFC 8018 Appendix A.2.
PBKDF2-params ::= SEQUENCE {
salt CHOICE {
specified OCTET STRING,
otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}
},
iterationCount INTEGER (1..MAX),
keyLength INTEGER (1..MAX) OPTIONAL,
prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT
algid-hmacWithSHA1 }Fields§
§salt: SaltPBKDF2 salt
iteration_count: u32PBKDF2 iteration count
key_length: Option<u16>PBKDF2 output length
prf: Pbkdf2PrfPseudo-random function to use with PBKDF2
Implementations§
Source§impl Pbkdf2Params
impl Pbkdf2Params
Sourcepub const MAX_ITERATION_COUNT: u32 = 100_000_000
pub const MAX_ITERATION_COUNT: u32 = 100_000_000
Implementation defined maximum iteration count of 100,000,000.
For especially critical keys, or for very powerful systems or systems where user-perceived performance is not critical, an iteration count of 10,000,000 may be appropriate.
See RFC 8018, §4.2 and RFC 8018, §A.2
Sourcepub fn hmac_sha256(iteration_count: u32, salt: &[u8]) -> Result<Self>
pub fn hmac_sha256(iteration_count: u32, salt: &[u8]) -> Result<Self>
Initialize PBKDF2-HMAC-SHA256 with the given iteration count and salt.
§Errors
Returns Error::AlgorithmParametersInvalid if iteration_count exceeds
Pbkdf2Params::MAX_ITERATION_COUNT or salt exceeds Salt::MAX_LEN.
Trait Implementations§
Source§impl Clone for Pbkdf2Params
impl Clone for Pbkdf2Params
impl Copy for Pbkdf2Params
Source§impl Debug for Pbkdf2Params
impl Debug for Pbkdf2Params
Source§impl<'a> DecodeValue<'a> for Pbkdf2Params
impl<'a> DecodeValue<'a> for Pbkdf2Params
Source§impl EncodeValue for Pbkdf2Params
impl EncodeValue for Pbkdf2Params
impl Eq for Pbkdf2Params
Source§impl From<Pbkdf2Params> for Kdf
impl From<Pbkdf2Params> for Kdf
Source§fn from(params: Pbkdf2Params) -> Self
fn from(params: Pbkdf2Params) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Pbkdf2Params
impl PartialEq for Pbkdf2Params
impl Sequence<'_> for Pbkdf2Params
impl StructuralPartialEq for Pbkdf2Params
Auto Trait Implementations§
impl Freeze for Pbkdf2Params
impl RefUnwindSafe for Pbkdf2Params
impl Send for Pbkdf2Params
impl Sync for Pbkdf2Params
impl Unpin for Pbkdf2Params
impl UnsafeUnpin for Pbkdf2Params
impl UnwindSafe for Pbkdf2Params
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 + 'a,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag + 'a,
Source§type Error = <T as DecodeValue<'a>>::Error
type Error = <T as DecodeValue<'a>>::Error
Type returned in the event of a decoding error.
Source§fn decode<R>(reader: &mut R) -> Result<T, <T as DecodeValue<'a>>::Error>where
R: Reader<'a>,
fn decode<R>(reader: &mut R) -> Result<T, <T as DecodeValue<'a>>::Error>where
R: Reader<'a>,
Attempt to decode this TLV message using the provided decoder. Read more
impl<T> DecodeOwned for Twhere
T: for<'a> Decode<'a>,
Source§impl<T> Encode for T
impl<T> Encode for T
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this TLV object in bytes when encoded as ASN.1 DER. Read more
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 TLV object to the provided byte slice, returning a sub-slice
containing the encoded message. Read more
Source§impl<T> IsConstructed for T
impl<T> IsConstructed for T
Source§const CONSTRUCTED: bool
const CONSTRUCTED: bool
ASN.1 constructed bit