[][src]Struct aes_ccm::CcmMode

pub struct CcmMode { /* fields omitted */ }

The AES-CCM instance.

Methods

impl CcmMode[src]

pub fn new(
    key: &[u8; 16],
    nonce: [u8; 13],
    mlen: usize
) -> Result<CcmMode, Error>
[src]

Creates a new CcmMode.

Valid mlen values are: 4, 6, 8, 10, 12, 14, 16. The nonce is consumed to prevent reuse, which would destroy security.

pub fn generate_encrypt<'a>(
    &self,
    out: &'a mut [u8],
    associated_data: &[u8],
    payload: &[u8]
) -> Result<&'a [u8], Error>
[src]

CCM tag generation and encryption procedure.

out buffer must be at least (payload.len() + c.mlen) bytes long. A slice to the encrypted output within the buffer will be returned.

pub fn decrypt_verify<'a>(
    &self,
    out: &'a mut [u8],
    associated_data: &[u8],
    payload: &[u8]
) -> Result<&'a [u8], Error>
[src]

CCM decryption and tag verification procedure.

out buffer must be at least (payload.len() - c.mlen) bytes long. A slice to the decrypted output within the buffer will be returned.

Auto Trait Implementations

impl Unpin for CcmMode

impl Sync for CcmMode

impl Send for CcmMode

impl UnwindSafe for CcmMode

impl RefUnwindSafe for CcmMode

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self