pub struct Parameters<'a> {
pub kdf: Kdf<'a>,
pub encryption: EncryptionScheme<'a>,
}Expand description
Password-Based Encryption Scheme 2 parameters as defined in RFC 8018 Appendix A.4.
PBES2-params ::= SEQUENCE {
keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},
encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} }Fields§
§kdf: Kdf<'a>Key derivation function
encryption: EncryptionScheme<'a>Encryption scheme
Implementations§
Source§impl<'a> Parameters<'a>
impl<'a> Parameters<'a>
Sourcepub fn pbkdf2_sha256_aes128cbc(
pbkdf2_iterations: u32,
pbkdf2_salt: &'a [u8],
aes_iv: &'a [u8; 16],
) -> Result<Self>
pub fn pbkdf2_sha256_aes128cbc( pbkdf2_iterations: u32, pbkdf2_salt: &'a [u8], aes_iv: &'a [u8; 16], ) -> Result<Self>
Initialize PBES2 parameters using PBKDF2-SHA256 as the password-based key derivation function and AES-128-CBC as the symmetric cipher.
Sourcepub fn pbkdf2_sha256_aes256cbc(
pbkdf2_iterations: u32,
pbkdf2_salt: &'a [u8],
aes_iv: &'a [u8; 16],
) -> Result<Self>
pub fn pbkdf2_sha256_aes256cbc( pbkdf2_iterations: u32, pbkdf2_salt: &'a [u8], aes_iv: &'a [u8; 16], ) -> Result<Self>
Initialize PBES2 parameters using PBKDF2-SHA256 as the password-based key derivation function and AES-256-CBC as the symmetric cipher.
Sourcepub fn scrypt_aes128cbc(
params: Params,
salt: &'a [u8],
aes_iv: &'a [u8; 16],
) -> Result<Self>
pub fn scrypt_aes128cbc( params: Params, salt: &'a [u8], aes_iv: &'a [u8; 16], ) -> Result<Self>
Initialize PBES2 parameters using scrypt as the password-based key derivation function and AES-128-CBC as the symmetric cipher.
For more information on scrypt parameters, see documentation for the
scrypt::Params struct.
Sourcepub fn scrypt_aes256cbc(
params: Params,
salt: &'a [u8],
aes_iv: &'a [u8; 16],
) -> Result<Self>
pub fn scrypt_aes256cbc( params: Params, salt: &'a [u8], aes_iv: &'a [u8; 16], ) -> Result<Self>
Initialize PBES2 parameters using scrypt as the password-based key derivation function and AES-256-CBC as the symmetric cipher.
For more information on scrypt parameters, see documentation for the
scrypt::Params struct.
When in doubt, use Default::default() as the scrypt::Params.
This also avoids the need to import the type from the scrypt crate.
Sourcepub fn decrypt(
&self,
password: impl AsRef<[u8]>,
ciphertext: &[u8],
) -> Result<Vec<u8>>
pub fn decrypt( &self, password: impl AsRef<[u8]>, ciphertext: &[u8], ) -> Result<Vec<u8>>
Attempt to decrypt the given ciphertext, allocating and returning a byte vector containing the plaintext.
Sourcepub fn decrypt_in_place<'b>(
&self,
password: impl AsRef<[u8]>,
buffer: &'b mut [u8],
) -> Result<&'b [u8]>
pub fn decrypt_in_place<'b>( &self, password: impl AsRef<[u8]>, buffer: &'b mut [u8], ) -> Result<&'b [u8]>
Attempt to decrypt the given ciphertext in-place using a key derived from the provided password and this scheme’s parameters.
Returns an error if the algorithm specified in this scheme’s parameters is unsupported, or if the ciphertext is malformed (e.g. not a multiple of a block mode’s padding)
Trait Implementations§
Source§impl<'a> Clone for Parameters<'a>
impl<'a> Clone for Parameters<'a>
Source§fn clone(&self) -> Parameters<'a>
fn clone(&self) -> Parameters<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for Parameters<'a>
impl<'a> Debug for Parameters<'a>
Source§impl<'a> DecodeValue<'a> for Parameters<'a>
impl<'a> DecodeValue<'a> for Parameters<'a>
Source§impl EncodeValue for Parameters<'_>
impl EncodeValue for Parameters<'_>
Source§impl<'a> From<Parameters<'a>> for EncryptionScheme<'a>
impl<'a> From<Parameters<'a>> for EncryptionScheme<'a>
Source§fn from(params: Parameters<'a>) -> EncryptionScheme<'a>
fn from(params: Parameters<'a>) -> EncryptionScheme<'a>
Source§impl<'a> PartialEq for Parameters<'a>
impl<'a> PartialEq for Parameters<'a>
Source§impl<'a> TryFrom<AnyRef<'a>> for Parameters<'a>
impl<'a> TryFrom<AnyRef<'a>> for Parameters<'a>
impl<'a> Eq for Parameters<'a>
impl<'a> Sequence<'a> for Parameters<'a>
impl<'a> StructuralPartialEq for Parameters<'a>
Auto Trait Implementations§
impl<'a> Freeze for Parameters<'a>
impl<'a> RefUnwindSafe for Parameters<'a>
impl<'a> Send for Parameters<'a>
impl<'a> Sync for Parameters<'a>
impl<'a> Unpin for Parameters<'a>
impl<'a> UnsafeUnpin for Parameters<'a>
impl<'a> UnwindSafe for Parameters<'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
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.