pub struct Aes256Gcm { /* private fields */ }Expand description
AES-256-GCM encryption implementation
Implementations§
Source§impl Aes256Gcm
impl Aes256Gcm
Sourcepub async fn from_key(data: &[u8]) -> Result<Self, ImportKeyError>
pub async fn from_key(data: &[u8]) -> Result<Self, ImportKeyError>
Creates a new AES-256-GCM instance from a raw key.
§Arguments
data- Raw key bytes (should be 32 bytes for AES-256)
§Returns
Result containing the Aes256Gcm instance or an ImportKeyError
§Errors
ImportKeyError::Syntaxif key usage array is emptyImportKeyError::Typeif key format/data is invalidImportKeyError::InvalidKeyFormatif provided key format is invalid
Trait Implementations§
Source§impl Algorithm for Aes256Gcm
impl Algorithm for Aes256Gcm
Source§const NONCE_SIZE: u32 = 12u32
const NONCE_SIZE: u32 = 12u32
Required nonce size in bytes for this algorithm
Source§async fn encrypt(
&self,
nonce: &Nonce<Self>,
payload: &[u8],
) -> Result<Vec<u8>, EncryptionError>
async fn encrypt( &self, nonce: &Nonce<Self>, payload: &[u8], ) -> Result<Vec<u8>, EncryptionError>
Encrypts data using this algorithm Read more
Source§async fn decrypt(
&self,
nonce: &Nonce<Self>,
payload: &[u8],
) -> Result<Vec<u8>, DecryptionError>
async fn decrypt( &self, nonce: &Nonce<Self>, payload: &[u8], ) -> Result<Vec<u8>, DecryptionError>
Decrypts data using this algorithm Read more
Source§fn generate_nonce() -> Result<Nonce<Self>, NonceError>
fn generate_nonce() -> Result<Nonce<Self>, NonceError>
Generates a new random nonce suitable for this algorithm Read more
Auto Trait Implementations§
impl Freeze for Aes256Gcm
impl RefUnwindSafe for Aes256Gcm
impl !Send for Aes256Gcm
impl !Sync for Aes256Gcm
impl Unpin for Aes256Gcm
impl UnwindSafe for Aes256Gcm
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