#[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>>
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)
Sourcepub fn encrypt(
&self,
password: impl AsRef<[u8]>,
plaintext: &[u8],
) -> Result<Vec<u8>>
pub fn encrypt( &self, password: impl AsRef<[u8]>, plaintext: &[u8], ) -> Result<Vec<u8>>
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]>
pub fn encrypt_in_place<'b>( &self, password: impl AsRef<[u8]>, buffer: &'b mut [u8], pos: usize, ) -> Result<&'b [u8]>
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 for EncryptionScheme<'a>
impl<'a> PartialEq for EncryptionScheme<'a>
Source§impl<'a> TryFrom<&'a [u8]> for EncryptionScheme<'a>
impl<'a> TryFrom<&'a [u8]> for EncryptionScheme<'a>
Source§impl<'a> TryFrom<AlgorithmIdentifier<AnyRef<'a>>> for EncryptionScheme<'a>
impl<'a> TryFrom<AlgorithmIdentifier<AnyRef<'a>>> for EncryptionScheme<'a>
Source§fn try_from(alg: AlgorithmIdentifierRef<'a>) -> Result<EncryptionScheme<'_>>
fn try_from(alg: AlgorithmIdentifierRef<'a>) -> Result<EncryptionScheme<'_>>
impl<'a> Eq for EncryptionScheme<'a>
impl<'a> Sequence<'a> for EncryptionScheme<'a>
impl<'a> StructuralPartialEq for EncryptionScheme<'a>
Auto Trait Implementations§
impl<'a> Freeze for EncryptionScheme<'a>
impl<'a> RefUnwindSafe for EncryptionScheme<'a>
impl<'a> Send for EncryptionScheme<'a>
impl<'a> Sync for EncryptionScheme<'a>
impl<'a> Unpin for EncryptionScheme<'a>
impl<'a> UnsafeUnpin for EncryptionScheme<'a>
impl<'a> UnwindSafe for EncryptionScheme<'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.