pub struct PaddedBlockEncryptingKey {
algorithm: &'static Algorithm,
key: SymmetricCipherKey,
mode: OperatingMode,
padding: PaddingStrategy,
}Expand description
A cipher encryption key that performs block padding.
Fields§
§algorithm: &'static Algorithm§key: SymmetricCipherKey§mode: OperatingMode§padding: PaddingStrategyImplementations§
Source§impl PaddedBlockEncryptingKey
impl PaddedBlockEncryptingKey
Sourcepub fn cbc_pkcs7(key: UnboundCipherKey) -> Result<Self, Unspecified>
pub fn cbc_pkcs7(key: UnboundCipherKey) -> Result<Self, Unspecified>
Constructs a new PaddedBlockEncryptingKey cipher with chaining block cipher (CBC) mode.
Plaintext data is padded following the PKCS#7 scheme.
§Errors
Unspecified: Returned if there is an error constructing aPaddedBlockEncryptingKey. Withlegacy-desenabled, also returned ifkeywas constructed withDES_FOR_LEGACY_USE_ONLY,DES_EDE_FOR_LEGACY_USE_ONLYorDES_EDE3_FOR_LEGACY_USE_ONLYand the provided key material contains weak or semi-weak DES subkeys, or (for Triple DES) a degenerate subkey configuration (e.g.K1 == K2for 2TDEA, or any pairwise equality for 3TDEA).
Sourcepub fn ecb_pkcs7(key: UnboundCipherKey) -> Result<Self, Unspecified>
pub fn ecb_pkcs7(key: UnboundCipherKey) -> Result<Self, Unspecified>
Constructs a new PaddedBlockEncryptingKey cipher with electronic code book (ECB) mode.
Plaintext data is padded following the PKCS#7 scheme.
§☠️ ️️️DANGER ☠️
Offered for computability purposes only. This is an extremely dangerous mode, and very likely not what you want to use.
§Errors
Unspecified: Returned if there is an error constructing aPaddedBlockEncryptingKey. Withlegacy-desenabled, also returned ifkeywas constructed withDES_FOR_LEGACY_USE_ONLY,DES_EDE_FOR_LEGACY_USE_ONLYorDES_EDE3_FOR_LEGACY_USE_ONLYand the provided key material contains weak or semi-weak DES subkeys, or (for Triple DES) a degenerate subkey configuration (e.g.K1 == K2for 2TDEA, or any pairwise equality for 3TDEA).
fn new( key: UnboundCipherKey, mode: OperatingMode, padding: PaddingStrategy, ) -> Result<PaddedBlockEncryptingKey, Unspecified>
Sourcepub fn mode(&self) -> OperatingMode
pub fn mode(&self) -> OperatingMode
Returns the cipher operating mode.
Sourcepub fn encrypt<InOut>(
&self,
in_out: &mut InOut,
) -> Result<DecryptionContext, Unspecified>
pub fn encrypt<InOut>( &self, in_out: &mut InOut, ) -> Result<DecryptionContext, Unspecified>
Pads and encrypts data provided in in_out in-place.
Returns a references to the encrypted data.
§Errors
Unspecified: Returned if encryption fails.
Sourcepub fn less_safe_encrypt<InOut>(
&self,
in_out: &mut InOut,
context: EncryptionContext,
) -> Result<DecryptionContext, Unspecified>
pub fn less_safe_encrypt<InOut>( &self, in_out: &mut InOut, context: EncryptionContext, ) -> Result<DecryptionContext, Unspecified>
Pads and encrypts data provided in in_out in-place.
Returns a references to the encryted data.
§Errors
Unspecified: Returned if encryption fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PaddedBlockEncryptingKey
impl RefUnwindSafe for PaddedBlockEncryptingKey
impl Send for PaddedBlockEncryptingKey
impl Sync for PaddedBlockEncryptingKey
impl Unpin for PaddedBlockEncryptingKey
impl UnsafeUnpin for PaddedBlockEncryptingKey
impl UnwindSafe for PaddedBlockEncryptingKey
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
Mutably borrows from an owned value. Read more