pub struct Aes128Gcm<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> { /* private fields */ }
Implementations§
Trait Implementations§
Source§impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128<'a> for Aes128Gcm<'a, A>
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128<'a> for Aes128Gcm<'a, A>
Source§fn set_client(&'a self, client: &'a dyn Client<'a>)
fn set_client(&'a self, client: &'a dyn Client<'a>)
Set the client instance which will receive
crypt_done()
callbacksSource§fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>
fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>
Set the encryption key.
Returns
INVAL
if length is not AES128_KEY_SIZE
Source§fn set_iv(&self, iv: &[u8]) -> Result<(), ErrorCode>
fn set_iv(&self, iv: &[u8]) -> Result<(), ErrorCode>
Set the IV (or initial counter).
Returns
INVAL
if length is not AES128_BLOCK_SIZE
Source§fn start_message(&self)
fn start_message(&self)
Begin a new message (with the configured IV) when
crypt()
is
next called. Multiple calls to crypt()
may be made between
calls to start_message()
, allowing the encryption context to
extend over non-contiguous extents of data. Read moreSource§impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128CBC for Aes128Gcm<'a, A>
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128CBC for Aes128Gcm<'a, A>
Source§impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128CCM<'a> for Aes128Gcm<'a, A>
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128CCM<'a> for Aes128Gcm<'a, A>
Source§fn set_client(&'a self, client: &'a dyn CCMClient)
fn set_client(&'a self, client: &'a dyn CCMClient)
Set the client instance which will receive
crypt_done()
callbacksSource§fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>
fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>
Set the key to be used for CCM encryption
Source§impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128Ctr for Aes128Gcm<'a, A>
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128Ctr for Aes128Gcm<'a, A>
Source§impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128ECB for Aes128Gcm<'a, A>
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128ECB for Aes128Gcm<'a, A>
Source§impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128GCM<'a> for Aes128Gcm<'a, A>
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> AES128GCM<'a> for Aes128Gcm<'a, A>
Source§fn set_client(&self, client: &'a dyn GCMClient)
fn set_client(&self, client: &'a dyn GCMClient)
Set the client instance which will receive
crypt_done()
callbacksSource§fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>
fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>
Set the key to be used for GCM encryption
Returns
INVAL
if length is not AES128_KEY_SIZE
Source§fn set_iv(&self, nonce: &[u8]) -> Result<(), ErrorCode>
fn set_iv(&self, nonce: &[u8]) -> Result<(), ErrorCode>
Set the IV to be used for GCM encryption. The IV should be less
or equal to 12 bytes (96 bits) as recommened in NIST-800-38D.
Returns
INVAL
if length is greater then 12 bytesSource§fn crypt(
&self,
buf: &'static mut [u8],
aad_offset: usize,
message_offset: usize,
message_len: usize,
encrypting: bool,
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn crypt( &self, buf: &'static mut [u8], aad_offset: usize, message_offset: usize, message_len: usize, encrypting: bool, ) -> Result<(), (ErrorCode, &'static mut [u8])>
Try to begin the encryption/decryption process
The possible ErrorCodes are:
-
BUSY
: An operation is already in progress
- SIZE
: The offset and lengths don’t fit inside the bufferSource§impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> CCMClient for Aes128Gcm<'a, A>
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'a>> CCMClient for Aes128Gcm<'a, A>
Source§fn crypt_done(
&self,
buf: &'static mut [u8],
res: Result<(), ErrorCode>,
tag_is_valid: bool,
)
fn crypt_done( &self, buf: &'static mut [u8], res: Result<(), ErrorCode>, tag_is_valid: bool, )
res
is Ok(()) if the encryption/decryption process succeeded. This
does not mean that the message has been verified in the case of
decryption.
If we are encrypting: tag_is_valid
is true
iff res
is Ok(()).
If we are decrypting: tag_is_valid
is true
iff res
is Ok(()) and the
message authentication tag is valid.Auto Trait Implementations§
impl<'a, A> !Freeze for Aes128Gcm<'a, A>
impl<'a, A> !RefUnwindSafe for Aes128Gcm<'a, A>
impl<'a, A> !Send for Aes128Gcm<'a, A>
impl<'a, A> !Sync for Aes128Gcm<'a, A>
impl<'a, A> Unpin for Aes128Gcm<'a, A>
impl<'a, A> !UnwindSafe for Aes128Gcm<'a, A>
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