Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 3.53 KB

CRYPTO.md

File metadata and controls

54 lines (43 loc) · 3.53 KB

Production cryptography (oxideon.crypto, crypto::secure)

oxideon does not implement cryptographic primitives. crypto::secure (Rust, cargo features secure-crypto and fhe) and oxideon.crypto (Python) are thin wrappers over vetted crates, and they handle the parts that wrappers usually get wrong: OS randomness, input validation, zeroizing secrets, and serialization with size limits.

Capability Scheme Backend Assurance of the backend
Key exchange ML-KEM-512/768/1024 (FIPS 203) libcrux-ml-kem 0.0.12 Formally verified (hax/F*) for correctness and secret independence
Secret sharing Feldman VSS, BLS12-381 scalar field vsss-rs 6, bls12_381 0.9 Widely used; bls12_381 is the curve crate used in Zcash
Proofs of inference Groth16 over BLS12-381 bellman 0.15, groth16 0.2 zkcrypto stack used in production by Zcash
Encrypted computation TFHE integers tfhe 1.8 (Zama) Production library, 128-bit security parameters
DP accounting RDP of the subsampled Gaussian oxideon (math, not crypto) Checked against numerical integration of the RDP definition

The wrappers themselves have not had an independent audit. Review them before protecting high-value secrets.

Building

The PyPI wheel enables both features (see pyproject.toml). From Rust:

oxideon = { version = "0.1", features = ["secure-crypto", "fhe"] }

fhe needs Rust 1.91 or newer. tfhe-rs is BSD-3-Clause-Clear, and Zama requires a patent license for commercial use of TFHE. Leave fhe off if that does not fit your product.

Things to know before you deploy

  • ML-KEM gives you a 32-byte key, not a channel. Use the key with an AEAD such as AES-GCM or ChaCha20-Poly1305. A tampered ciphertext decapsulates to an unrelated key and is not reported as an error (implicit rejection), so the AEAD is what detects tampering.
  • Feldman VSS publishes g^secret. Only share secrets with high entropy, such as keys. Always pass the commitments to feldman_combine so that a corrupted share fails loudly instead of giving a wrong secret.
  • Groth16 needs a trusted setup for each model shape. Whoever knows the setup randomness can forge proofs. The verifier (or an MPC ceremony) must run zk_setup and give only the proving key to the prover.
    • What is proven: y = M(x) under the documented integer semantics: int16 weights, int32 biases and activations, floor(z / 2^shift) requantization, ReLU on hidden layers. M is the model committed to by SHA-256(salt || weights || biases).
    • x and y are public. The weights and the salt stay private.
  • TFHE arithmetic wraps modulo 2^64, like i64::wrapping_*.
    • The server key can compute on ciphertexts but cannot decrypt them.
    • Ciphertexts arriving from another party are deserialized with size limits and parameter-conformance checks.
  • DP-SGD (oxideon.privacy.DP_SGD) clips each example's whole gradient. Call accumulate() after every single-example backward().
    • Accounting assumes Poisson sampling, the same approximation as Opacus and TF-Privacy.
    • seed= is for tests only: a known noise seed voids the privacy guarantee.
  • Python bytes cannot be wiped from memory. Keep secret keys in as few objects as you can.

Legacy demo engines

Everything else under crypto is educational code and not for real data: fhe::CkksContext, zkml, lattice_lwe, shamir_feldman_threshold_mpc, kzg_polynomial_commitment, groth16_qap_zk_snark and fri_reed_solomon_stark. See the security warning in crypto/mod.rs.