Enum pkcs5::EncryptionScheme
source · #[non_exhaustive]
pub enum EncryptionScheme<'a> {
Pbes1(Algorithm),
Pbes2(Parameters<'a>),
}
Expand description
Supported PKCS#5 password-based encryption schemes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Pbes1(Algorithm)
Password-Based Encryption Scheme 1 as defined in RFC 8018 Section 6.1.
Pbes2(Parameters<'a>)
Password-Based Encryption Scheme 2 as defined in RFC 8018 Section 6.2.
Implementations§
source§impl<'a> EncryptionScheme<'a>
impl<'a> EncryptionScheme<'a>
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 ciphertext in-place using a key derived from the provided password and this scheme’s parameters.
sourcepub fn oid(&self) -> ObjectIdentifier
pub fn oid(&self) -> ObjectIdentifier
Get the ObjectIdentifier
(a.k.a OID) for this algorithm.
sourcepub fn pbes1(&self) -> Option<&Algorithm>
pub fn pbes1(&self) -> Option<&Algorithm>
Get pbes1::Parameters
if it is the selected algorithm.
sourcepub fn pbes2(&self) -> Option<&Parameters<'a>>
pub fn pbes2(&self) -> Option<&Parameters<'a>>
Get pbes2::Parameters
if it is the selected algorithm.
Trait Implementations§
source§impl<'a> Clone for EncryptionScheme<'a>
impl<'a> Clone for EncryptionScheme<'a>
source§fn clone(&self) -> EncryptionScheme<'a>
fn clone(&self) -> EncryptionScheme<'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 EncryptionScheme<'a>
impl<'a> Debug for EncryptionScheme<'a>
source§impl<'a> DecodeValue<'a> for EncryptionScheme<'a>
impl<'a> DecodeValue<'a> for EncryptionScheme<'a>
source§impl EncodeValue for EncryptionScheme<'_>
impl EncodeValue for EncryptionScheme<'_>
source§impl<'a> From<Algorithm> for EncryptionScheme<'a>
impl<'a> From<Algorithm> for EncryptionScheme<'a>
source§fn from(alg: Algorithm) -> EncryptionScheme<'a>
fn from(alg: Algorithm) -> EncryptionScheme<'a>
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<EncryptionScheme<'a>> for EncryptionScheme<'a>
impl<'a> PartialEq<EncryptionScheme<'a>> for EncryptionScheme<'a>
source§fn eq(&self, other: &EncryptionScheme<'a>) -> bool
fn eq(&self, other: &EncryptionScheme<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.