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
sourceimpl<'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
sourceimpl<'a> Clone for EncryptionScheme<'a>
impl<'a> Clone for EncryptionScheme<'a>
sourcefn clone(&self) -> EncryptionScheme<'a>
fn clone(&self) -> EncryptionScheme<'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 EncryptionScheme<'a>
impl<'a> Debug for EncryptionScheme<'a>
sourceimpl<'a> DecodeValue<'a> for EncryptionScheme<'a>
impl<'a> DecodeValue<'a> for EncryptionScheme<'a>
sourceimpl<'a> From<Algorithm> for EncryptionScheme<'a>
impl<'a> From<Algorithm> for EncryptionScheme<'a>
sourcefn from(alg: Algorithm) -> EncryptionScheme<'a>
fn from(alg: Algorithm) -> EncryptionScheme<'a>
Converts to this type from the input type.
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<EncryptionScheme<'a>> for EncryptionScheme<'a>
impl<'a> PartialEq<EncryptionScheme<'a>> for EncryptionScheme<'a>
sourcefn eq(&self, other: &EncryptionScheme<'a>) -> bool
fn eq(&self, other: &EncryptionScheme<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &EncryptionScheme<'a>) -> bool
fn ne(&self, other: &EncryptionScheme<'a>) -> bool
This method tests for !=
.
sourceimpl<'a> Sequence<'a> for EncryptionScheme<'a>
impl<'a> Sequence<'a> for EncryptionScheme<'a>
sourceimpl<'a> TryFrom<AlgorithmIdentifier<'a>> for EncryptionScheme<'a>
impl<'a> TryFrom<AlgorithmIdentifier<'a>> for EncryptionScheme<'a>
sourcefn try_from(alg: AlgorithmIdentifier<'a>) -> Result<EncryptionScheme<'_>>
fn try_from(alg: AlgorithmIdentifier<'a>) -> Result<EncryptionScheme<'_>>
Performs the conversion.
impl<'a> Eq for EncryptionScheme<'a>
impl<'a> StructuralEq for EncryptionScheme<'a>
impl<'a> StructuralPartialEq for EncryptionScheme<'a>
Auto Trait Implementations
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> UnwindSafe for EncryptionScheme<'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<'a, T> Decode<'a> for T where
T: DecodeValue<'a> + FixedTag,
impl<'a, T> Decode<'a> for T where
T: DecodeValue<'a> + FixedTag,
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