Trait nettle::cipher::Cipher[][src]

pub trait Cipher: Sized {
    const BLOCK_SIZE: usize;
    const KEY_SIZE: usize;

    fn with_decrypt_key(key: &[u8]) -> Result<Self>;
fn with_encrypt_key(key: &[u8]) -> Result<Self>;
fn decrypt(&mut self, dst: &mut [u8], src: &[u8]);
fn encrypt(&mut self, dst: &mut [u8], src: &[u8]);
fn context(&mut self) -> *mut c_void;
fn raw_decrypt_function() -> RawCipherFunctionPointer;
fn raw_encrypt_function() -> RawCipherFunctionPointer; }
Expand description

Symmetric block or stream cipher.

Symmetric cipher encrypt and decrypt data using the same key.

Associated Constants

Block size in bytes.

Maximal key size in bytes.

Required methods

Creates a new cipher instance for decryption. The key parameter must have size KEY_SIZE.

Creates a new cipher instance for encryption. The key parameter must have size KEY_SIZE.

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.

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.

Returns a pointer to the C context struct of the cipher instance. Used internally by block modi.

Pointer to the *_decrypt C function. Used internally for block modi.

Pointer to the *_encrypt C function. Used internally for block modi.

Implementors