Trait nettle::cipher::Cipher [−][src]
Symmetric block or stream cipher.
Symmetric cipher encrypt and decrypt data using the same key.
Associated Constants
const BLOCK_SIZE: usize
[src]
Block size in bytes.
const KEY_SIZE: usize
[src]
Maximal key size in bytes.
Required methods
fn with_decrypt_key(key: &[u8]) -> Result<Self>
[src]
Creates a new cipher instance for decryption. The key
parameter must have size
KEY_SIZE
.
fn with_encrypt_key(key: &[u8]) -> Result<Self>
[src]
Creates a new cipher instance for encryption. The key
parameter must have size
KEY_SIZE
.
fn decrypt(&mut self, dst: &mut [u8], src: &[u8])
[src]
Decrypt src
into dst
. Both must have the same length. That length must be a multiple of
BLOCK_SIZE
. Blocks are processed in ECB mode.
fn encrypt(&mut self, dst: &mut [u8], src: &[u8])
[src]
Encrypt src
into dst
. Both must have the same length. That length must be a multiple of
BLOCK_SIZE
. Blocks are processed in ECB mode.
fn context(&mut self) -> *mut c_void
[src]
Returns a pointer to the C context struct of the cipher instance. Used internally by block modi.
fn raw_decrypt_function() -> RawCipherFunctionPointer
[src]
Pointer to the *_decrypt C function. Used internally for block modi.
fn raw_encrypt_function() -> RawCipherFunctionPointer
[src]
Pointer to the *_encrypt C function. Used internally for block modi.