pub struct AesCcm<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> { /* private fields */ }Expand description
AES-CCM Cipher Mode (Counter with CBC-MAC)
Implementations§
Source§impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
Sourcepub fn new(
key: &'c [u8; KEY_SIZE],
iv: &'c [u8; IV_SIZE],
aad_len: usize,
payload_len: usize,
) -> Self
pub fn new( key: &'c [u8; KEY_SIZE], iv: &'c [u8; IV_SIZE], aad_len: usize, payload_len: usize, ) -> Self
Constructs a new AES-CCM cipher for a cryptographic operation.
key: The encryption key (16 or 32 bytes)iv: The nonce/IV (7-13 bytes recommended, typically 12 bytes)aad_len: Length of additional authenticated data (known in advance)payload_len: Length of payload data (known in advance)
Note: CCM requires knowing the data lengths in advance.
Trait Implementations§
Source§impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> Cipher<'c> for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> Cipher<'c> for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
Source§const REQUIRES_PADDING: bool = false
const REQUIRES_PADDING: bool = false
Indicates whether the cipher requires the application to provide padding.
Source§fn init_phase_blocking<T: Instance, M: Mode>(
&self,
p: Aes,
_aes: &Aes<'_, T, M>,
)
fn init_phase_blocking<T: Instance, M: Mode>( &self, p: Aes, _aes: &Aes<'_, T, M>, )
Performs any cipher-specific initialization.
Source§async fn init_phase<T: Instance>(&self, p: Aes, _aes: &mut Aes<'_, T, Async>)
async fn init_phase<T: Instance>(&self, p: Aes, _aes: &mut Aes<'_, T, Async>)
Performs any cipher-specific initialization (async).
Source§fn pre_final(&self, p: Aes, _dir: Direction, padding_len: usize) -> [u32; 4]
fn pre_final(&self, p: Aes, _dir: Direction, padding_len: usize) -> [u32; 4]
Called prior to processing the last data block for cipher-specific operations.
Source§fn uses_gcm_phases(&self) -> bool
fn uses_gcm_phases(&self) -> bool
Indicates whether this cipher mode uses GCM/CCM phases (init, header, payload, final).
Source§fn is_ccm_mode(&self) -> bool
fn is_ccm_mode(&self) -> bool
Indicates whether this is CCM mode (which has different final phase handling).
CCM doesn’t use a length block in the final phase, unlike GCM.
Source§fn ccm_b0(&self) -> Option<&[u8; 16]>
fn ccm_b0(&self) -> Option<&[u8; 16]>
Returns the pre-computed B0 block for CCM mode (None for other modes).
Source§const BLOCK_SIZE: usize = 16usize
const BLOCK_SIZE: usize = 16usize
Processing block size (always 16 bytes for AES).
Source§fn prepare_key(&self, _p: Aes, _dir: Direction)
fn prepare_key(&self, _p: Aes, _dir: Direction)
Performs any key preparation within the processor, if necessary.
Source§fn post_final_blocking<T: Instance, M: Mode>(
&self,
_p: Aes,
_aes: &Aes<'_, T, M>,
_dir: Direction,
_int_data: &mut [u8; 16],
_temp1: [u32; 4],
_padding_mask: [u8; 16],
)
fn post_final_blocking<T: Instance, M: Mode>( &self, _p: Aes, _aes: &Aes<'_, T, M>, _dir: Direction, _int_data: &mut [u8; 16], _temp1: [u32; 4], _padding_mask: [u8; 16], )
Called after processing the last data block for cipher-specific operations.
Source§async fn post_final<T: Instance>(
&self,
_p: Aes,
_aes: &mut Aes<'_, T, Async>,
_dir: Direction,
_int_data: &mut [u8; 16],
_temp1: [u32; 4],
_padding_mask: [u8; 16],
)
async fn post_final<T: Instance>( &self, _p: Aes, _aes: &mut Aes<'_, T, Async>, _dir: Direction, _int_data: &mut [u8; 16], _temp1: [u32; 4], _padding_mask: [u8; 16], )
Called after processing the last data block for cipher-specific operations (async).
Source§fn get_header_block(&self) -> &[u8]
fn get_header_block(&self) -> &[u8]
Returns the AAD header block as required by the cipher (for authenticated modes).
Source§impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> CipherAuthenticated<TAG_SIZE> for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> CipherAuthenticated<TAG_SIZE> for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const IV_SIZE: usize, const TAG_SIZE: usize> CipherSized for AesCcm<'c, { _ }, IV_SIZE, TAG_SIZE>
impl<'c, const IV_SIZE: usize, const TAG_SIZE: usize> CipherSized for AesCcm<'c, { _ }, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> IVSized for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
Auto Trait Implementations§
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> Freeze for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> RefUnwindSafe for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> Send for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> Sync for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> Unpin for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
impl<'c, const KEY_SIZE: usize, const IV_SIZE: usize, const TAG_SIZE: usize> UnwindSafe for AesCcm<'c, KEY_SIZE, IV_SIZE, TAG_SIZE>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more