STREAM
Encrypt a sequence of segments with any of the algorithms above.
from oxcrypto.aead.aes_gcm import AES_GCM
key = AES_GCM.AES256.generate()
nonce = bytes(7) # 12-byte AES-GCM nonce minus 5 bytes of STREAM counter
encryptor = key.encryptor(nonce)
first = encryptor.encrypt_next(b"first segment")
last = encryptor.encrypt_last(b"last segment")
decryptor = key.decryptor(nonce)
decryptor.decrypt_next(first)
decryptor.decrypt_last(last)STREAM derives a nonce for each segment from the nonce prefix, a segment counter
and a last-segment flag, so reordered, dropped or truncated segments fail with
oxcrypto.InvalidTag. counter="be32" (default) appends a 32-bit big-endian
counter and a flag byte (5 bytes); counter="le31" appends a 31-bit
little-endian counter with the flag in the top bit (4 bytes). Both take
associated_data per segment.
Encryptors and decryptors are single use. After encrypt_last or
decrypt_last, or after any failure, every further call raises ValueError.
| Construction | Hoang, Reyhanitabar, Rogaway and Vizár, "Online Authenticated-Encryption and its Nonce-Reuse Misuse-Resistance" (CRYPTO 2015). Not standardized. |
| Crate | aead-stream 0.6.0 |
| Maturity | Stable release. No published audit. |
| MSRV | Builds with Rust 1.88. |
| Zeroization | The wrapped AEAD crate wipes its own state as described on its page. The STREAM counter and nonce prefix are not secret. |
| Experimental | No |
| Test vectors | None published; segments are checked against the one-shot AEAD with the derived nonce. |