pub struct Encryptor<C: BlockCipher> { /* private fields */ }Available on crate features
aes or tdes only.Expand description
Stateful encryptor object for unauthenticated symmetric ciphers used in the SSH packet encryption protocol.
Implementations§
Source§impl<C: BlockCipher> Encryptor<C>
impl<C: BlockCipher> Encryptor<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 encryptor object with the given Cipher, key, and iv (i.e.
initialization vector).
§Errors
- Returns
Error::Cryptoif the givenciphercannot be used withEncryptor. - 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> BlockModeEncrypt for Encryptor<C>
impl<C: BlockCipher> BlockModeEncrypt for Encryptor<C>
Source§fn encrypt_with_backend(
&mut self,
f: impl BlockModeEncClosure<BlockSize = Self::BlockSize>,
)
fn encrypt_with_backend( &mut self, f: impl BlockModeEncClosure<BlockSize = Self::BlockSize>, )
Encrypt data using backend provided to the rank-2 closure.
Source§fn encrypt_block_inout(
&mut self,
block: InOut<'_, '_, Array<u8, Self::BlockSize>>,
)
fn encrypt_block_inout( &mut self, block: InOut<'_, '_, Array<u8, Self::BlockSize>>, )
Encrypt single
inout block.Source§fn encrypt_blocks_inout(
&mut self,
blocks: InOutBuf<'_, '_, Array<u8, Self::BlockSize>>,
)
fn encrypt_blocks_inout( &mut self, blocks: InOutBuf<'_, '_, Array<u8, Self::BlockSize>>, )
Encrypt
inout blocks.Source§fn encrypt_block(&mut self, block: &mut Array<u8, Self::BlockSize>)
fn encrypt_block(&mut self, block: &mut Array<u8, Self::BlockSize>)
Encrypt single block in-place.
Source§fn encrypt_block_b2b(
&mut self,
in_block: &Array<u8, Self::BlockSize>,
out_block: &mut Array<u8, Self::BlockSize>,
)
fn encrypt_block_b2b( &mut self, in_block: &Array<u8, Self::BlockSize>, out_block: &mut Array<u8, Self::BlockSize>, )
Encrypt
in_block and write result to out_block.Source§impl<C: BlockCipher> BlockSizeUser for Encryptor<C>
impl<C: BlockCipher> BlockSizeUser for Encryptor<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 Encryptor<C>
impl<C> RefUnwindSafe for Encryptor<C>where
C: RefUnwindSafe,
<<C as BlockSizeUser>::BlockSize as ArraySize>::ArrayType<u8>: RefUnwindSafe,
impl<C> Send for Encryptor<C>where
C: Send,
impl<C> Sync for Encryptor<C>where
C: Sync,
impl<C> Unpin for Encryptor<C>
impl<C> UnsafeUnpin for Encryptor<C>
impl<C> UnwindSafe for Encryptor<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