pub trait Aes256Ccm {
type Context: Send + Sync + Clone;
// Required methods
fn init(key: &[u8; 32]) -> Self::Context;
fn encrypt(
ctx: &Self::Context,
nonce: &[u8],
aad: &[u8],
buffer: InOutBuf<'_, '_, u8>,
tag: &mut [u8],
) -> Result<(), Error>;
fn decrypt(
ctx: &Self::Context,
nonce: &[u8],
aad: &[u8],
buffer: InOutBuf<'_, '_, u8>,
tag: &[u8],
) -> Result<(), Error>;
}Expand description
AES-256 CCM driver.
Required Associated Types§
Required Methods§
Sourcefn encrypt(
ctx: &Self::Context,
nonce: &[u8],
aad: &[u8],
buffer: InOutBuf<'_, '_, u8>,
tag: &mut [u8],
) -> Result<(), Error>
fn encrypt( ctx: &Self::Context, nonce: &[u8], aad: &[u8], buffer: InOutBuf<'_, '_, u8>, tag: &mut [u8], ) -> Result<(), Error>
Encrypt buffer and produce the authentication tag.
The tag length is the length of the tag slice. Nonce and tag
lengths not allowed by the spec return Error::InvalidInput.
Sourcefn decrypt(
ctx: &Self::Context,
nonce: &[u8],
aad: &[u8],
buffer: InOutBuf<'_, '_, u8>,
tag: &[u8],
) -> Result<(), Error>
fn decrypt( ctx: &Self::Context, nonce: &[u8], aad: &[u8], buffer: InOutBuf<'_, '_, u8>, tag: &[u8], ) -> Result<(), Error>
Verify the authentication tag and decrypt buffer.
The tag length is the length of the tag slice. Nonce and tag
lengths not allowed by the spec return Error::InvalidInput.
The tag is verified in constant time; on mismatch this returns
Error::InvalidSignature and the buffer contents are unspecified.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".