AES-GCM
Encrypt with AES-128, AES-192 or AES-256 in Galois/Counter Mode.
import os
from oxcrypto.aead.aes_gcm import AES_GCM
key = AES_GCM.AES256.generate()
nonce = os.urandom(12)
sealed = key.encrypt(nonce, b"message", associated_data=b"header")
plaintext = key.decrypt(nonce, sealed, associated_data=b"header")Variants: AES128, AES192, AES256.
Never reuse a nonce with the same key: reuse reveals the authentication key.
| Standard | NIST SP 800-38D (Recommendation, final). |
| Crate | aes-gcm 0.11.1 |
| Maturity | Stable release. No published audit of 0.11; NCC Group published an audit of aes-gcm 0.8 in 2020. |
| MSRV | Builds with Rust 1.88. |
| Zeroization | aes and ghash/polyval with zeroize are written to wipe the AES round keys and the GHASH key and state on drop, and ctr to wipe the counter state. oxcrypto has not verified this independently. |
| Experimental | No |
| Test vectors | Wycheproof aes_gcm_test.json |