Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Protect the message body with AES-256-GCM and ChaCha20-Poly1305

Authenticated encryption with associated data (AEAD) protects the message body so that only key holders can decrypt it. It also detects changes to the received data. In QuantAegis, Envelope derives the AEAD key and nonce from the KEM shared secret. You supply the body, the recipient, and any additional authenticated data (AAD), such as an order number.

How it works · AES-256-GCM encryption and tags · The ChaCha20 keystream and Poly1305

SDK identifierHow it encrypts the bodyHow it detects changes
aes-256-gcmUses AES with a 256-bit key in counter modeComputes an authentication tag using GHASH
chacha20-poly1305Combines the body with a keystream generated by ChaCha20Computes an authentication tag using Poly1305

Both algorithms use a 12-byte nonce and a 16-byte authentication tag in envelope v1. Both parties exchanging packets must support QuantAegis’s QAEN v1 format, including the header, key derivation, and AAD construction. The sender and recipient must supply matching AAD. Put confidential values in the body.

from quantaegis import Envelope

public_key, secret_key = Envelope.generate_keypair("x-wing")
packet = Envelope.seal(public_key, b"invoice", aead="chacha20-poly1305")
assert Envelope.open(secret_key, packet) == b"invoice"

Envelope format · NIST SP 800-38D (GCM) · RFC 8439 (ChaCha20-Poly1305)