Struct cipher::BlockModeDecryptWrapper[][src]

pub struct BlockModeDecryptWrapper<M: BlockModeDecrypt, P: Padding<M::BlockSize>> { /* fields omitted */ }

Convinience wrapper around the BlockModeDecrypt trait, which handles data buffering and provides slice-based methods.

Implementations

impl<M, P> BlockModeDecryptWrapper<M, P> where
    M: BlockModeDecrypt,
    P: Padding<M::BlockSize>, 
[src]

pub fn decrypt_part<'a>(
    &mut self,
    ciphertext: &[u8],
    out_buf: &'a mut [u8]
) -> Result<&'a [u8], BlockModeError>
[src]

Decrypt part of a ciphertext.

This mehthod MUST be used in conjuction with the decrypt_final method, otherwise plaintext will not be properly padded and may be truncated.

The method decrypts ciphertext, writes the resulting plaintext into out_buf, and returns it in the Ok variant. If a whole message can not be processed, it caches ciphertext leftovers into inner buffer for future use.

It’s recommended for out_buf to be at least one block longer than data, otherwise the method can return Err(BlockModeError) if there is not enough space for encrypted blocks.

pub fn decrypt_final<'a>(
    self,
    ciphertext: &[u8],
    out_buf: &'a mut [u8]
) -> Result<&'a [u8], BlockModeError>
[src]

Pad and decrypt plaintext.

The method decrypts ciphertext, writes the resulting plaintext into into out_buf, and unpads it.

It’s recommended for out_buf to be at least one block longer than data, otherwise the method can return Err(BlockModeError) if there is not enough space for encrypted blocks.

Trait Implementations

impl<M, P> FromBlockCipherNonce for BlockModeDecryptWrapper<M, P> where
    M: BlockModeDecrypt + FromBlockCipherNonce,
    P: Padding<M::BlockSize>, 
[src]

type BlockCipher = M::BlockCipher

Block cipher used for initialization.

type NonceSize = M::NonceSize

Nonce size in bytes.

Auto Trait Implementations

impl<M, P> RefUnwindSafe for BlockModeDecryptWrapper<M, P> where
    M: RefUnwindSafe,
    P: RefUnwindSafe,
    <<M as BlockMode>::BlockSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe

impl<M, P> Send for BlockModeDecryptWrapper<M, P> where
    M: Send,
    P: Send

impl<M, P> Sync for BlockModeDecryptWrapper<M, P> where
    M: Sync,
    P: Sync

impl<M, P> Unpin for BlockModeDecryptWrapper<M, P> where
    M: Unpin,
    P: Unpin,
    <<M as BlockMode>::BlockSize as ArrayLength<u8>>::ArrayType: Unpin

impl<M, P> UnwindSafe for BlockModeDecryptWrapper<M, P> where
    M: UnwindSafe,
    P: UnwindSafe,
    <<M as BlockMode>::BlockSize as ArrayLength<u8>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FromKeyNonce for T where
    T: FromBlockCipherNonce,
    <T as FromBlockCipherNonce>::BlockCipher: FromKey
[src]

type KeySize = <<T as FromBlockCipherNonce>::BlockCipher as FromKey>::KeySize

Key size in bytes.

type NonceSize = <T as FromBlockCipherNonce>::NonceSize

Nonce size in bytes.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.