pub struct Decryptor<C: BlockCipher> { /* private fields */ }Available on crate features
aes or tdes only.Expand description
Stateful decryptor object for unauthenticated symmetric ciphers used in the SSH packet encryption protocol.
Note we need encryption support for decryption in order to support AES-CTR, where encryption and decryption are the same operation.
Implementations§
Source§impl<C: BlockCipher> Decryptor<C>
impl<C: BlockCipher> Decryptor<C>
Sourcepub fn new(cipher: Cipher, key: &[u8], iv: &[u8]) -> Result<Self>
pub fn new(cipher: Cipher, key: &[u8], iv: &[u8]) -> Result<Self>
Create a new decryptor object with the given Cipher, key, and iv (i.e.
initialization vector).
§Errors
- Returns
Error::Cryptoif the givenciphercannot be used withDecryptor. - Returns
Error::Lengthifkeyorivare the wrong length for the givencipher. - Returns
Error::UnsupportedCipherif support for the givencipheris not enabled in the crate features.
Trait Implementations§
Source§impl<C: BlockCipher> BlockModeDecrypt for Decryptor<C>
impl<C: BlockCipher> BlockModeDecrypt for Decryptor<C>
Source§fn decrypt_with_backend(
&mut self,
_f: impl BlockModeDecClosure<BlockSize = Self::BlockSize>,
)
fn decrypt_with_backend( &mut self, _f: impl BlockModeDecClosure<BlockSize = Self::BlockSize>, )
Decrypt data using backend provided to the rank-2 closure.
Source§fn decrypt_block(&mut self, block: &mut Block<Self>)
fn decrypt_block(&mut self, block: &mut Block<Self>)
Decrypt single block in-place.
Source§fn decrypt_blocks(&mut self, blocks: &mut [Block<Self>])
fn decrypt_blocks(&mut self, blocks: &mut [Block<Self>])
Decrypt blocks in-place.
Source§fn decrypt_block_inout(
&mut self,
block: InOut<'_, '_, Array<u8, Self::BlockSize>>,
)
fn decrypt_block_inout( &mut self, block: InOut<'_, '_, Array<u8, Self::BlockSize>>, )
Decrypt single
inout block.Source§fn decrypt_blocks_inout(
&mut self,
blocks: InOutBuf<'_, '_, Array<u8, Self::BlockSize>>,
)
fn decrypt_blocks_inout( &mut self, blocks: InOutBuf<'_, '_, Array<u8, Self::BlockSize>>, )
Decrypt
inout blocks.Source§impl<C: BlockCipher> BlockSizeUser for Decryptor<C>
impl<C: BlockCipher> BlockSizeUser for Decryptor<C>
Source§type BlockSize = <C as BlockSizeUser>::BlockSize
type BlockSize = <C as BlockSizeUser>::BlockSize
Size of the block in bytes.
Source§fn block_size() -> usize
fn block_size() -> usize
Return block size in bytes.
Auto Trait Implementations§
impl<C> Freeze for Decryptor<C>
impl<C> RefUnwindSafe for Decryptor<C>where
C: RefUnwindSafe,
<<C as BlockSizeUser>::BlockSize as ArraySize>::ArrayType<u8>: RefUnwindSafe,
impl<C> Send for Decryptor<C>where
C: Send,
impl<C> Sync for Decryptor<C>where
C: Sync,
impl<C> Unpin for Decryptor<C>
impl<C> UnsafeUnpin for Decryptor<C>
impl<C> UnwindSafe for Decryptor<C>
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