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

pub struct Crypter { /* fields omitted */ }

Represents a symmetric cipher context.

Methods

impl Crypter
[src]

Creates a new Crypter.

Panics

Panics if an IV is required by the cipher but not provided.

Enables or disables padding.

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

Sets the tag used to authenticate ciphertext in AEAD ciphers such as AES GCM.

When decrypting cipher text using an AEAD cipher, this must be called before finalize.

Feeds Additional Authenticated Data (AAD) through the cipher.

This can only be used with AEAD ciphers such as AES GCM. Data fed in is not encrypted, but is factored into the authentication tag. It must be called before the first call to update.

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 Cipher::block_size), or if output.len() > c_int::max_value().

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.

Retrieves the authentication tag used to authenticate ciphertext in AEAD ciphers such as AES GCM.

When encrypting data with an AEAD cipher, this must be called after finalize.

The size of the buffer indicates the required size of the tag. While some ciphers support a range of tag sizes, it is recommended to pick the maximum size. For AES GCM, this is 16 bytes, for example.

Trait Implementations

impl Drop for Crypter
[src]

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