[−][src]Struct aes_ccm::CcmMode
The AES-CCM instance.
Methods
impl CcmMode
[src]
pub fn new(
key: &[u8; 16],
nonce: [u8; 13],
mlen: usize
) -> Result<CcmMode, Error>
[src]
key: &[u8; 16],
nonce: [u8; 13],
mlen: usize
) -> Result<CcmMode, Error>
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]
&self,
out: &'a mut [u8],
associated_data: &[u8],
payload: &[u8]
) -> Result<&'a [u8], Error>
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]
&self,
out: &'a mut [u8],
associated_data: &[u8],
payload: &[u8]
) -> Result<&'a [u8], Error>
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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self