pub struct DynamicEme<C: BlockCipher> { /* private fields */ }
Expand description
EME block mode instance with dynamic block size.
There is no fixed BlockSize
for this mode. The BlockSize
is determined
by the length of the given input, which must be between 16 and 2048 bytes
and also divisible by 16.
Implementations§
Source§impl<C: BlockEncryptMut + BlockCipher + BlockSizeUser<BlockSize = U16>> DynamicEme<C>
impl<C: BlockEncryptMut + BlockCipher + BlockSizeUser<BlockSize = U16>> DynamicEme<C>
Sourcepub fn encrypt_block_mut(&mut self, block: &mut [u8])
pub fn encrypt_block_mut(&mut self, block: &mut [u8])
Encrypt block in-place.
§Panics
- When
block
length is greater than 2048 - When
block
length is not divisible by 16
Sourcepub fn encrypt_blocks_inout_mut(&mut self, chunks: InOutBuf<'_, '_, Block<C>>)
pub fn encrypt_blocks_inout_mut(&mut self, chunks: InOutBuf<'_, '_, Block<C>>)
Sourcepub fn encrypt_blocks_mut(&mut self, blocks: &mut [Block<C>])
pub fn encrypt_blocks_mut(&mut self, blocks: &mut [Block<C>])
Sourcepub fn encrypt_padded_inout_mut<'inp, 'out, P: Padding<C::BlockSize>>(
&mut self,
data: InOutBufReserved<'inp, 'out, u8>,
) -> Result<&'out [u8], PadError>
Available on crate feature block-padding
only.
pub fn encrypt_padded_inout_mut<'inp, 'out, P: Padding<C::BlockSize>>( &mut self, data: InOutBufReserved<'inp, 'out, u8>, ) -> Result<&'out [u8], PadError>
block-padding
only.Sourcepub fn encrypt_padded_mut<'b, P: Padding<C::BlockSize>>(
&mut self,
buf: &'b mut [u8],
msg_len: usize,
) -> Result<&'b [u8], PadError>
Available on crate feature block-padding
only.
pub fn encrypt_padded_mut<'b, P: Padding<C::BlockSize>>( &mut self, buf: &'b mut [u8], msg_len: usize, ) -> Result<&'b [u8], PadError>
block-padding
only.Source§impl<C: BlockEncryptMut + BlockDecryptMut + BlockCipher + BlockSizeUser<BlockSize = U16>> DynamicEme<C>
impl<C: BlockEncryptMut + BlockDecryptMut + BlockCipher + BlockSizeUser<BlockSize = U16>> DynamicEme<C>
Sourcepub fn decrypt_block_mut(&mut self, block: &mut [u8])
pub fn decrypt_block_mut(&mut self, block: &mut [u8])
Decrypt block in-place.
§Panics
- When
block
length is greater than 2048 - When
block
length is not divisible by 16
Sourcepub fn decrypt_blocks_inout_mut(&mut self, chunks: InOutBuf<'_, '_, Block<C>>)
pub fn decrypt_blocks_inout_mut(&mut self, chunks: InOutBuf<'_, '_, Block<C>>)
Sourcepub fn decrypt_blocks_mut(&mut self, blocks: &mut [Block<C>])
pub fn decrypt_blocks_mut(&mut self, blocks: &mut [Block<C>])
Sourcepub fn decrypt_padded_inout_mut<'inp, 'out, P: Padding<C::BlockSize>>(
self,
data: InOutBuf<'inp, 'out, u8>,
) -> Result<&'out [u8], UnpadError>
Available on crate feature block-padding
only.
pub fn decrypt_padded_inout_mut<'inp, 'out, P: Padding<C::BlockSize>>( self, data: InOutBuf<'inp, 'out, u8>, ) -> Result<&'out [u8], UnpadError>
block-padding
only.Decrypt input and unpad it. Returns resulting ciphertext slice.
§Errors
Returns UnpadError
if padding is malformed or if input length is
not multiple of C::BlockSize
.
§Panics
- When
data
length is greater than 2048 - When
data
length is not divisible by 16
Sourcepub fn decrypt_padded_mut<P: Padding<C::BlockSize>>(
self,
buf: &mut [u8],
) -> Result<&[u8], UnpadError>
Available on crate feature block-padding
only.
pub fn decrypt_padded_mut<P: Padding<C::BlockSize>>( self, buf: &mut [u8], ) -> Result<&[u8], UnpadError>
block-padding
only.Decrypt input and unpad it in-place. Returns resulting ciphertext slice.
§Errors
Returns UnpadError
if padding is malformed or if input length is
not multiple of C::BlockSize
.
§Panics
- When
buf
length is greater than 2048 - When
buf
length is not divisible by 16
Sourcepub fn decrypt_padded_b2b_mut<'a, P: Padding<C::BlockSize>>(
self,
in_buf: &[u8],
out_buf: &'a mut [u8],
) -> Result<&'a [u8], UnpadError>
Available on crate feature block-padding
only.
pub fn decrypt_padded_b2b_mut<'a, P: Padding<C::BlockSize>>( self, in_buf: &[u8], out_buf: &'a mut [u8], ) -> Result<&'a [u8], UnpadError>
block-padding
only.Decrypt input and unpad it buffer-to-buffer. Returns resulting ciphertext slice.
§Errors
Returns UnpadError
if padding is malformed or if input length is
not multiple of C::BlockSize
.
§Panics
- When
in_buf
length is greater than 2048 - When
in_buf
length is not divisible by 16
Trait Implementations§
Source§impl<C> AlgorithmName for DynamicEme<C>
impl<C> AlgorithmName for DynamicEme<C>
Source§fn write_alg_name(f: &mut Formatter<'_>) -> Result
fn write_alg_name(f: &mut Formatter<'_>) -> Result
f
.Source§impl<C: Clone + BlockCipher> Clone for DynamicEme<C>
impl<C: Clone + BlockCipher> Clone for DynamicEme<C>
Source§fn clone(&self) -> DynamicEme<C>
fn clone(&self) -> DynamicEme<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<C> Debug for DynamicEme<C>
impl<C> Debug for DynamicEme<C>
Source§impl<C> InnerIvInit for DynamicEme<C>
impl<C> InnerIvInit for DynamicEme<C>
Source§fn inner_iv_init(cipher: C, iv: &Iv<Self>) -> Self
fn inner_iv_init(cipher: C, iv: &Iv<Self>) -> Self
inner
and iv
array.Source§fn inner_iv_slice_init(
inner: Self::Inner,
iv: &[u8],
) -> Result<Self, InvalidLength>
fn inner_iv_slice_init( inner: Self::Inner, iv: &[u8], ) -> Result<Self, InvalidLength>
inner
and iv
slice.