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; }

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.

Loading content...

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.

Loading content...

Implementors

impl Cipher for ArcFour[src]

impl Cipher for ArcTwo[src]

impl Cipher for Des[src]

impl Cipher for Aes128[src]

impl Cipher for Aes192[src]

impl Cipher for Aes256[src]

impl Cipher for Blowfish[src]

impl Cipher for Camellia128[src]

impl Cipher for Camellia192[src]

impl Cipher for Camellia256[src]

impl Cipher for Cast128[src]

impl Cipher for Des3[src]

impl Cipher for Serpent[src]

impl Cipher for Twofish[src]

Loading content...