Struct aes_gcm::AesGcm [−][src]
pub struct AesGcm<Aes, NonceSize> where
Aes: BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>, { /* fields omitted */ }
Expand description
AES-GCM: generic over an underlying AES implementation and nonce size.
This type is generic to support substituting alternative AES implementations (e.g. embedded hardware implementations)
It is NOT intended to be instantiated with any block cipher besides AES! Doing so runs the risk of unintended cryptographic properties!
The N
generic parameter can be used to instantiate AES-GCM with other
nonce sizes, however it’s recommended to use it with typenum::U12
,
the default of 96-bits.
If in doubt, use the built-in Aes128Gcm
and Aes256Gcm
type aliases.
Trait Implementations
impl<Aes, NonceSize> AeadCore for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
impl<Aes, NonceSize> AeadCore for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
type NonceSize = NonceSize
type NonceSize = NonceSize
The length of a nonce.
type TagSize = U16
type TagSize = U16
The maximum length of the nonce.
type CiphertextOverhead = U0
type CiphertextOverhead = U0
The upper bound amount of additional space required to support a ciphertext vs. a plaintext. Read more
impl<Aes, NonceSize> AeadInPlace for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
impl<Aes, NonceSize> AeadInPlace for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
Encrypt the data in-place, returning the authentication tag
Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext (i.e. ciphertext is modified/unauthentic) Read more
Encrypt the given buffer containing a plaintext message in-place. Read more
impl<Aes: Clone, NonceSize: Clone> Clone for AesGcm<Aes, NonceSize> where
Aes: BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
impl<Aes: Clone, NonceSize: Clone> Clone for AesGcm<Aes, NonceSize> where
Aes: BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
impl<Aes, NonceSize> From<Aes> for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
impl<Aes, NonceSize> From<Aes> for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
impl<Aes, NonceSize> NewAead for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
impl<Aes, NonceSize> NewAead for AesGcm<Aes, NonceSize> where
Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt,
Aes::ParBlocks: ArrayLength<Block<Aes>>,
NonceSize: ArrayLength<u8>,
Create a new AEAD instance with the given key.
Create new AEAD instance from key given as a byte slice.. Read more
Auto Trait Implementations
impl<Aes, NonceSize> RefUnwindSafe for AesGcm<Aes, NonceSize> where
Aes: RefUnwindSafe,
NonceSize: RefUnwindSafe,
impl<Aes, NonceSize> UnwindSafe for AesGcm<Aes, NonceSize> where
Aes: UnwindSafe,
NonceSize: UnwindSafe,
Blanket Implementations
Encrypt the given plaintext payload, and return the resulting ciphertext as a vector of bytes. Read more
Encrypt the given plaintext slice, and return the resulting ciphertext as a vector of bytes. Read more
Encrypt the given buffer containing a plaintext message in-place. Read more
Encrypt the data in-place, returning the authentication tag
Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext. Read more
Decrypt the data in-place, returning an error in the event the provided authentication tag does not match the given ciphertext (i.e. ciphertext is modified/unauthentic) Read more
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self