Skip to main content

AeadPlugin

Trait AeadPlugin 

Source
pub trait AeadPlugin: Sized {
    // Required methods
    fn create_with_key(
        algorithm: &str,
        key: &[u8],
        opts: Option<OptionView<'_>>,
    ) -> PluginResult<Self>;
    fn set_nonce(&mut self, nonce: &[u8]) -> PluginResult<()>;
    fn associated_data_update(&mut self, data: &[u8]) -> PluginResult<()>;
    fn encrypt_update(
        &mut self,
        input: &[u8],
        output: &mut [u8],
    ) -> PluginResult<usize>;
    fn decrypt_update(
        &mut self,
        input: &[u8],
        output: &mut [u8],
    ) -> PluginResult<usize>;
    fn finalize(&mut self, tag: &mut [u8]) -> PluginResult<usize>;
    fn verify_tag(&mut self, tag: &[u8]) -> PluginResult<()>;
}
Expand description

Trait implemented by AEAD plugins.

Required Methods§

Source

fn create_with_key( algorithm: &str, key: &[u8], opts: Option<OptionView<'_>>, ) -> PluginResult<Self>

Construct a new AEAD instance for the named algorithm with the given key.

Source

fn set_nonce(&mut self, nonce: &[u8]) -> PluginResult<()>

Set the nonce for this encryption/decryption session.

Source

fn associated_data_update(&mut self, data: &[u8]) -> PluginResult<()>

Absorb associated (authenticated but not encrypted) data.

Source

fn encrypt_update( &mut self, input: &[u8], output: &mut [u8], ) -> PluginResult<usize>

Encrypt a chunk of plaintext. Returns the number of bytes written to output.

Source

fn decrypt_update( &mut self, input: &[u8], output: &mut [u8], ) -> PluginResult<usize>

Decrypt a chunk of ciphertext. Returns the number of bytes written to output.

Source

fn finalize(&mut self, tag: &mut [u8]) -> PluginResult<usize>

Finalize and write the authentication tag into tag. Returns the number of bytes written.

Source

fn verify_tag(&mut self, tag: &[u8]) -> PluginResult<()>

Verify the provided tag. Returns Ok(()) if valid.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§