pub enum StringToKey {
Simple {
hash_alg: HashAlgorithm,
},
Salted {
hash_alg: HashAlgorithm,
salt: [u8; 8],
},
Reserved {
unknown: Vec<u8>,
},
IteratedAndSalted {
hash_alg: HashAlgorithm,
salt: [u8; 8],
count: u8,
},
Argon2 {
salt: [u8; 16],
t: u8,
p: u8,
m_enc: u8,
},
Private {
typ: u8,
unknown: Vec<u8>,
},
Other {
typ: u8,
unknown: Vec<u8>,
},
}
Variants§
Implementations§
Source§impl StringToKey
impl StringToKey
pub fn new_default<R: CryptoRng + Rng>(rng: R) -> Self
pub fn new_iterated<R: CryptoRng + Rng>( rng: R, hash_alg: HashAlgorithm, count: u8, ) -> Self
pub fn new_argon2<R: CryptoRng + Rng>(rng: R, t: u8, p: u8, m_enc: u8) -> Self
pub fn id(&self) -> u8
Sourcepub fn derive_key(&self, passphrase: &str, key_size: usize) -> Result<Vec<u8>>
pub fn derive_key(&self, passphrase: &str, key_size: usize) -> Result<Vec<u8>>
String-To-Key methods are used to convert a given password string into a key. Ref: https://www.rfc-editor.org/rfc/rfc9580.html#name-string-to-key-s2k-specifier
Note that RFC 9580 specifies that:
- Implementations MUST NOT generate packets using MD5, SHA-1, or RIPEMD-160 as a hash function in an S2K KDF.
- Implementations MUST NOT decrypt a secret using MD5, SHA-1, or RIPEMD-160 as a hash function in an S2K KDF in a version 6 (or later) packet.
Trait Implementations§
Source§impl Clone for StringToKey
impl Clone for StringToKey
Source§fn clone(&self) -> StringToKey
fn clone(&self) -> StringToKey
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 Debug for StringToKey
impl Debug for StringToKey
Source§impl PartialEq for StringToKey
impl PartialEq for StringToKey
Source§impl Serialize for StringToKey
impl Serialize for StringToKey
impl Eq for StringToKey
impl StructuralPartialEq for StringToKey
Auto Trait Implementations§
impl Freeze for StringToKey
impl RefUnwindSafe for StringToKey
impl Send for StringToKey
impl Sync for StringToKey
impl Unpin for StringToKey
impl UnwindSafe for StringToKey
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