pub struct Aes256GcmCipher { /* private fields */ }Expand description
AES-256-GCM cipher implementation.
Provides authenticated encryption with associated data (AEAD).
- Key size: 256 bits (32 bytes)
- Nonce size: 96 bits (12 bytes)
- Tag size: 128 bits (16 bytes)
§Ciphertext Format
[nonce: 12 bytes][ciphertext + tag: variable]Implementations§
Source§impl Aes256GcmCipher
impl Aes256GcmCipher
Sourcepub const NONCE_SIZE: usize = 12
pub const NONCE_SIZE: usize = 12
Nonce size in bytes (96 bits).
Sourcepub fn new(key: &EncryptionKey) -> CryptoResult<Self>
pub fn new(key: &EncryptionKey) -> CryptoResult<Self>
Create a new AES-256-GCM cipher with the given key.
Trait Implementations§
Source§impl Cipher for Aes256GcmCipher
Available on crate feature aes only.
impl Cipher for Aes256GcmCipher
Available on crate feature
aes only.Source§fn encrypt(
&self,
plaintext: &[u8],
associated_data: Option<&[u8]>,
) -> CryptoResult<Vec<u8>>
fn encrypt( &self, plaintext: &[u8], associated_data: Option<&[u8]>, ) -> CryptoResult<Vec<u8>>
Encrypt plaintext with optional associated data. Read more
Source§fn decrypt(
&self,
ciphertext: &[u8],
associated_data: Option<&[u8]>,
) -> CryptoResult<Vec<u8>>
fn decrypt( &self, ciphertext: &[u8], associated_data: Option<&[u8]>, ) -> CryptoResult<Vec<u8>>
Decrypt ciphertext with optional associated data. Read more
Source§fn nonce_size(&self) -> usize
fn nonce_size(&self) -> usize
Get the nonce size in bytes.
Auto Trait Implementations§
impl Freeze for Aes256GcmCipher
impl RefUnwindSafe for Aes256GcmCipher
impl Send for Aes256GcmCipher
impl Sync for Aes256GcmCipher
impl Unpin for Aes256GcmCipher
impl UnsafeUnpin for Aes256GcmCipher
impl UnwindSafe for Aes256GcmCipher
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