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§
Sourcefn create_with_key(
algorithm: &str,
key: &[u8],
opts: Option<OptionView<'_>>,
) -> PluginResult<Self>
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.
Sourcefn set_nonce(&mut self, nonce: &[u8]) -> PluginResult<()>
fn set_nonce(&mut self, nonce: &[u8]) -> PluginResult<()>
Set the nonce for this encryption/decryption session.
Sourcefn associated_data_update(&mut self, data: &[u8]) -> PluginResult<()>
fn associated_data_update(&mut self, data: &[u8]) -> PluginResult<()>
Absorb associated (authenticated but not encrypted) data.
Sourcefn encrypt_update(
&mut self,
input: &[u8],
output: &mut [u8],
) -> PluginResult<usize>
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.
Sourcefn decrypt_update(
&mut self,
input: &[u8],
output: &mut [u8],
) -> PluginResult<usize>
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.
Sourcefn finalize(&mut self, tag: &mut [u8]) -> PluginResult<usize>
fn finalize(&mut self, tag: &mut [u8]) -> PluginResult<usize>
Finalize and write the authentication tag into tag. Returns
the number of bytes written.
Sourcefn verify_tag(&mut self, tag: &[u8]) -> PluginResult<()>
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".