Rust crates
Use quantaegis-sdk to encrypt data for a recipient. From the repository root, run cargo run --locked -p quantaegis-sdk --example envelope. The example uses OS randomness for key generation and encapsulation and checks the recovered bytes before it exits.
//! Encrypt and open an order message with authenticated associated data.
use quantaegis_core::Result;
use quantaegis_sdk::{AeadAlgorithm, AgileKeyPair, Envelope, KemAlgorithm, SecurityPolicy};
fn main() -> Result<()> {
let policy = SecurityPolicy::CryptrecCategory3Plus;
let recipient = AgileKeyPair::generate(policy, KemAlgorithm::MlKem768)?;
let aad = b"order=42";
let packet = Envelope::seal(
policy,
&recipient.public,
AeadAlgorithm::Aes256Gcm,
b"ship on Friday",
aad,
)?;
let message = Envelope::open(policy, &recipient.secret, &packet, aad)?;
assert_eq!(message, b"ship on Friday");
Ok(())
}
Envelope::seal returns Result<Vec<u8>>. The example propagates errors from key generation, encryption and decryption with ?. Envelope methods · Error variants
See the Rust SDK migration example for how to switch stored data to X-Wing and enforce the cutover policy.
For lower-level operations, consult the crate documentation built from this checkout. ML-KEM · ML-DSA · SLH-DSA · Hybrid schemes · SHA-3 · DRBG
Envelope::open checks the header’s KEM against the policy and the recipient key before authenticating the body. A packet can therefore produce Error::PolicyViolation or Error::InvalidDecapsulationKey before AEAD verification. When calling primitives directly, provide your own CryptoRng implementation. For SLH-DSA on a small stack, use sign_into with a caller-supplied signature buffer.