Skip to content
Live demo →

PQ crypto API

A thin, checked wrapper over aws-lc-rs. No custom cryptography.

Primitive Standard Sizes
ML-KEM-768, ML-KEM-1024 NIST FIPS 203 public key 1184 / 1568 B, private key 2400 / 3168 B
ML-DSA-65, ML-DSA-87 NIST FIPS 204 (pure mode, empty context) public key 1952 / 2592 B, private key PKCS#8 DER holding the 32-byte seed
AES-256-GCM NIST SP 800-38D 32-byte key, random 96-bit nonce, 16-byte tag; sealed = nonce, ciphertext, tag
Sealed box ML-KEM-1024 (optionally with X25519), HKDF-SHA384, AES-256-GCM version byte, suite byte, KEM ciphertext, nonce, ciphertext and tag

The snippet below was written from the function signatures and has not been compiled.

use unicomm_core::pqc::{self, KemAlg, SigAlg};
let kp = pqc::kem_keygen(KemAlg::MlKem1024)?; // KeyPair { public, private }
let (ct, ss_sender) = pqc::kem_encapsulate(KemAlg::MlKem1024, &kp.public)?;
let ss_receiver = pqc::kem_decapsulate(KemAlg::MlKem1024, &kp.private, &ct)?;
assert_eq!(*ss_sender, *ss_receiver);
let sig_kp = pqc::dsa_keygen(SigAlg::MlDsa87)?;
let sig = pqc::dsa_sign(SigAlg::MlDsa87, &sig_kp.private, b"release.tar")?;
assert!(pqc::dsa_verify(SigAlg::MlDsa87, &sig_kp.public, b"release.tar", &sig)?);
let key = pqc::random_bytes(32)?;
let sealed = pqc::aes256gcm_seal(&key, b"aad", b"secret")?;
let plain = pqc::aes256gcm_open(&key, b"aad", &sealed)?;

The one-call JSON form, pqc::call_json_str(opts), takes {"op": ...} and returns {"ok": true, ...} or {"ok": false, "error_code": ...}. Binary values are standard base64. Operations: algorithms, keygen, encapsulate, decapsulate, sign, verify, aead_seal, aead_open, box_seal, box_open. For example {"op":"keygen","alg":"ml-kem-1024"} returns {"ok":true,"alg":"ml-kem-1024","public_key":"...","private_key":"..."}.

  • Keys are returned zeroized-on-drop in Rust (Zeroizing), but anything that crosses into JSON or another language is a plain string you must handle carefully. Never log a private key.
  • The sealed-box wire format is version 1 and is a UniComm design, not a standard. Do not treat it as interoperable with other libraries.
  • Existing, merged, related feature: release signing with ML-DSA-87 (unicomm sign keygen | pubkey | sign FILE | verify FILE, ADR-0019).