Struct openssl::crypto::symm::Crypter [] [src]

pub struct Crypter {
    // some fields omitted
}

Represents a symmetric cipher context.

Methods

impl Crypter
[src]

fn new(t: Type, mode: Mode, key: &[u8], iv: Option<&[u8]>) -> Result<CrypterErrorStack>

Creates a new Crypter.

Panics

Panics if an IV is required by the cipher but not provided, or if the IV's length does not match the expected length (see Type::iv_len).

fn pad(&mut self, padding: bool)

Enables or disables padding.

If padding is disabled, total amount of data encrypted/decrypted must be a multiple of the cipher's block size.

fn update(&mut self, input: &[u8], output: &mut [u8]) -> Result<usizeErrorStack>

Feeds data from input through the cipher, writing encrypted/decrypted bytes into output.

The number of bytes written to output is returned. Note that this may not be equal to the length of input.

Panics

Panics if output.len() < input.len() + block_size where block_size is the block size of the cipher (see Type::block_size), or if output.len() > c_int::max_value().

fn finalize(&mut self, output: &mut [u8]) -> Result<usizeErrorStack>

Finishes the encryption/decryption process, writing any remaining data to output.

The number of bytes written to output is returned.

update should not be called after this method.

Panics

Panics if output is less than the cipher's block size.

Trait Implementations

impl Drop for Crypter
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more