Skip to main content

Module crypto

Module crypto 

Source
Expand description

Post-Quantum Cryptography Module for ZAP

Provides ML-KEM-768 key exchange, ML-DSA-65 signatures, and hybrid X25519+ML-KEM handshake.

§Security

This module implements NIST FIPS 203 (ML-KEM) and FIPS 204 (ML-DSA) standards for post-quantum cryptographic protection. The hybrid handshake combines classical X25519 with ML-KEM-768 for defense-in-depth.

§Example

use zap::crypto::{PQKeyExchange, PQSignature, HybridHandshake};

// Key exchange
let alice = PQKeyExchange::generate()?;
let (ciphertext, shared_alice) = alice.encapsulate(&bob_pk)?;
let shared_bob = bob.decapsulate(&ciphertext)?;
assert_eq!(shared_alice, shared_bob);

// Signatures
let signer = PQSignature::generate()?;
let sig = signer.sign(b"message")?;
signer.verify(b"message", &sig)?;

// Hybrid handshake
let initiator = HybridHandshake::initiate()?;
let (responder, response) = HybridHandshake::respond(&initiator.public_data())?;
let shared = initiator.finalize(&response)?;

Structs§

HybridHandshake
PQKeyExchange
PQSignature

Constants§

HYBRID_SHARED_SECRET_SIZE
Hybrid shared secret size after HKDF
MLDSA_PUBLIC_KEY_SIZE
ML-DSA-65 public key size in bytes
MLDSA_SECRET_KEY_SIZE
ML-DSA-65 secret key size in bytes
MLDSA_SIGNATURE_SIZE
ML-DSA-65 signature size in bytes
MLKEM_CIPHERTEXT_SIZE
ML-KEM-768 ciphertext size in bytes
MLKEM_PUBLIC_KEY_SIZE
ML-KEM-768 public key size in bytes
MLKEM_SHARED_SECRET_SIZE
ML-KEM-768 shared secret size in bytes
X25519_PUBLIC_KEY_SIZE
X25519 public key size in bytes