pub struct AesCcm { /* private fields */ }Expand description
AES in CCM (counter with CBC-MAC) authenticated mode, as in NIST SP 800-38C.
CCM needs the total length of the additional authenticated data and of the payload up
front. Only the first tag_len bytes of the tag returned by
Symmetric::aes_blocking_finish are valid.
Implementations§
Source§impl AesCcm
impl AesCcm
Sourcepub fn new(
key: &[u8],
nonce: &[u8],
aad_len: usize,
payload_len: usize,
tag_len: usize,
) -> Result<Self, Error>
pub fn new( key: &[u8], nonce: &[u8], aad_len: usize, payload_len: usize, tag_len: usize, ) -> Result<Self, Error>
Creates a CCM cipher.
key: 16, 24 or 32 bytes. See the module documentation for which key lengths each chip supports.nonce: 7 to 13 bytes, unique for every message.aad_len: total length of the additional authenticated data.payload_len: total length of the payload.tag_len: 4, 6, 8, 10, 12, 14 or 16 bytes.
A shorter nonce allows a longer payload. With a 13-byte nonce the payload is limited to 65535 bytes.
Errors: InvalidKeyLength, InvalidNonceLength, InvalidTagLength, and
InvalidLength if the payload is too long for the nonce.
Trait Implementations§
impl AuthenticatedCipher for AesCcm
impl Cipher for AesCcm
impl Copy for AesCcm
Auto Trait Implementations§
impl Freeze for AesCcm
impl RefUnwindSafe for AesCcm
impl Send for AesCcm
impl Sync for AesCcm
impl Unpin for AesCcm
impl UnsafeUnpin for AesCcm
impl UnwindSafe for AesCcm
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