Struct pkcs5::pbes2::Parameters
source · [−]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
sourceimpl<'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>
Available on crate feature scrypt
only.
pub fn scrypt_aes128cbc(
params: Params,
salt: &'a [u8],
aes_iv: &'a [u8; 16]
) -> Result<Self>
scrypt
only.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>
Available on crate feature scrypt
only.
pub fn scrypt_aes256cbc(
params: Params,
salt: &'a [u8],
aes_iv: &'a [u8; 16]
) -> Result<Self>
scrypt
only.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>>
Available on crate features alloc
and pbes2
only.
pub fn decrypt(
&self,
password: impl AsRef<[u8]>,
ciphertext: &[u8]
) -> Result<Vec<u8>>
alloc
and pbes2
only.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]>
Available on crate feature pbes2
only.
pub fn decrypt_in_place<'b>(
&self,
password: impl AsRef<[u8]>,
buffer: &'b mut [u8]
) -> Result<&'b [u8]>
pbes2
only.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)
sourcepub fn encrypt(
&self,
password: impl AsRef<[u8]>,
plaintext: &[u8]
) -> Result<Vec<u8>>
Available on crate features alloc
and pbes2
only.
pub fn encrypt(
&self,
password: impl AsRef<[u8]>,
plaintext: &[u8]
) -> Result<Vec<u8>>
alloc
and pbes2
only.Encrypt the given plaintext, allocating and returning a vector containing the ciphertext.
sourcepub fn encrypt_in_place<'b>(
&self,
password: impl AsRef<[u8]>,
buffer: &'b mut [u8],
pos: usize
) -> Result<&'b [u8]>
Available on crate feature pbes2
only.
pub fn encrypt_in_place<'b>(
&self,
password: impl AsRef<[u8]>,
buffer: &'b mut [u8],
pos: usize
) -> Result<&'b [u8]>
pbes2
only.Encrypt the given plaintext in-place using a key derived from the provided password and this scheme’s parameters, writing the ciphertext into the same buffer.
Trait Implementations
sourceimpl<'a> Clone for Parameters<'a>
impl<'a> Clone for Parameters<'a>
sourcefn clone(&self) -> Parameters<'a>
fn clone(&self) -> Parameters<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for Parameters<'a>
impl<'a> Debug for Parameters<'a>
sourceimpl<'a> Decode<'a> for Parameters<'a>
impl<'a> Decode<'a> for Parameters<'a>
sourceimpl<'a> From<Parameters<'a>> for EncryptionScheme<'a>
impl<'a> From<Parameters<'a>> for EncryptionScheme<'a>
sourcefn from(params: Parameters<'a>) -> EncryptionScheme<'a>
fn from(params: Parameters<'a>) -> EncryptionScheme<'a>
Converts to this type from the input type.
sourceimpl<'a> PartialEq<Parameters<'a>> for Parameters<'a>
impl<'a> PartialEq<Parameters<'a>> for Parameters<'a>
sourcefn eq(&self, other: &Parameters<'a>) -> bool
fn eq(&self, other: &Parameters<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Parameters<'a>) -> bool
fn ne(&self, other: &Parameters<'a>) -> bool
This method tests for !=
.
sourceimpl<'a> Sequence<'a> for Parameters<'a>
impl<'a> Sequence<'a> for Parameters<'a>
sourceimpl<'a> TryFrom<AnyRef<'a>> for Parameters<'a>
impl<'a> TryFrom<AnyRef<'a>> for Parameters<'a>
impl<'a> Eq for Parameters<'a>
impl<'a> StructuralEq for Parameters<'a>
impl<'a> StructuralPartialEq for Parameters<'a>
Auto Trait Implementations
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> UnwindSafe for Parameters<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<'a, T> Choice<'a> for T where
T: Decode<'a> + FixedTag,
impl<'a, T> Choice<'a> for T where
T: Decode<'a> + FixedTag,
sourcefn can_decode(tag: Tag) -> bool
fn can_decode(tag: Tag) -> bool
Is the provided Tag
decodable as a variant of this CHOICE
?
sourceimpl<T> Encode for T where
T: EncodeValue + Tagged,
impl<T> Encode for T where
T: EncodeValue + Tagged,
sourceimpl<'a, M> EncodeValue for M where
M: Sequence<'a>,
impl<'a, M> EncodeValue for M where
M: Sequence<'a>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more