Docs
Getting started with NextSSL
Build the C ABI library once, then call any algorithm by name from Rust, Python, JavaScript, Java, PHP, Swift or C.
1 · Build the library
cargo build -p nextssl-ffi --release
cargo build -p nextssl-ffi --release --features everything # + copyleft and heavy algorithmsProduces libnextssl_ffi (.so, .dylib or .dll) and a static library. Every binding is a thin layer over it.
2 · Call an algorithm
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
root = NextSSL(root=True) # every tier
digest = ns.call("hash_with", "sha256", None, b"abc")[0]
key, nonce = ns.random(32), ns.random(12)
ct = ns.call("aead_seal", "aes-256-gcm", None, key, nonce, b"hdr", b"secret")[0]
pk, sk = ns.call("kem_keygen", "ml-kem-768", None, outs=2)
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let digest = reg::hash_in(reg::all(), Policy::Safe, "sha256", &Params::new(), b"abc")?;
let kem = reg::new_kem_in(reg::all(), Policy::Safe, "ml-kem-768", &Params::new())?;
let (pk, sk) = kem.keygen(&mut *rng)?;
#include "nextssl.h"
nextssl_hash_with("sha256", NULL, data, out);
nextssl_aead_seal("aes-256-gcm", NULL, key, nonce, aad, pt, out); /* ct || tag */
nextssl_kem_keygen("ml-kem-768", NULL, pk, sk);
nextssl_root_hash_with("md5", NULL, data, out); /* non-safe tier */
3 · Compose constructions
Constructions are small expressions of lowercase names, nested up to four deep and validated before anything runs. A name in the wrong slot, an unknown name or an unsupported combination is an explicit error.
nextssl_root::compose("hmac(sha256)")?;
nextssl_root::compose("hkdf(sha256)")?;
nextssl_root::compose("pbkdf2(hmac(sha256))")?;
nextssl_root::compose("cmac(aes-128)")?;
nextssl_root::compose("cbc(aes-256)")?;
nextssl_root::compose("hmac-drbg(sha256)")?;Language bindings
Verify it yourself
cargo xtask gen --check # generated tables, json and header are current cargo xtask check-symbols # exports are nextssl_*, upstream symbols prefixed cargo test --workspace