onecrypto
A cryptography library for .NET in C#: CMS and S/MIME, X.509, PKCS#12, PEM and SSH keys, and the primitives .NET lacks, such as Ed25519, X25519 and Argon2. Cryptography, not cryptocurrency.
Not audited. In the project’s words: “This library has not been independently audited.” It is a preview, 0.1.0-preview.1, and the API can change. Its certificate path validator is a preview too: don’t rely on it for trust decisions yet.
A quick look
One call loads any key or certificate file, whatever its format. The keys it returns sign, decrypt or agree directly, including the Ed25519 keys .NET can’t load.
Getting startedusing RecursiveAI.OneCrypto; using RecursiveAI.OneCrypto.Keys; using LoadedItems file = Crypto.Load("demo.pfx", _ => "demo"); Certificate cert = file.Certificates[0]; ISigningKey key = file.PrivateKeys[0].Signing!; byte[] data = "hello"u8.ToArray(); byte[] signature = key.Sign(data, key.DefaultSpec); key.DefaultSpec.Verify(cert.PublicKey, data, signature); // Status: Valid
What it does
Any key file, one call
PEM and DER, PKCS#8 plain or encrypted, PKCS#12, legacy RSA and EC PEM, and OpenSSH keys and certificates, read by content. PKCS#12 and OpenSSH keys are written too.
CMS and S/MIME
Signed, enveloped and authenticated-enveloped data with every recipient type, a report for each verification rule, and streaming for large files. Decryption fails closed.
Certificates and issuing
X.509 certificates, requests, CRLs and OCSP read and built, RFC 3161 time-stamps, and a certificate authority, time-stamp authority and OCSP responder as handlers with no I/O.
What .NET lacks
Ed25519, Ed448, X25519 and X448, AES-OCB, EAX and key wrap, Argon2, scrypt and bcrypt-pbkdf, and Camellia, in managed code.
The platform first
RSA, ECDSA, ECDH, AES and hashes come from .NET itself. Where a platform lacks one, only SHA-3, ChaCha20-Poly1305 and RSA and ECDSA verification have a managed fallback; anything else is a typed error naming the platform.
Policy and two-phase signing
Dated rules for SHA-1, MD5 and RSA sizes, with presets. Signatures can be prepared in one process and signed by a key held elsewhere.
Before you rely on it
- Audit
“This library has not been independently audited.” Fuzzing, test vectors and comparisons with other tools are its evidence so far.
- Path validation
The RFC 5280 path builder and validator is a preview. It “has had an internal review; its follow-ups are still landing, so don’t rely on it for trust decisions yet.” CMS verification checks signatures without it unless you ask.
- Constant time
For secret data (plaintext, ciphertext, messages), timing tests pass at 1,000,000 measurements per class on x64 and arm64 for AES-EAX, AES key wrap, Blowfish and Camellia-128 and -256; Ed25519 and Ed448 signing, X25519 and X448, OCB, CAST5, IDEA, Twofish, ChaCha20-Poly1305 and Argon2i are covered by “earlier, shorter runs”. “No constant-time claim is made for key handling” yet. Argon2id, Argon2d, scrypt and bcrypt-pbkdf access memory by data by design.
- Platforms
.NET 10. The availability table is generated for Linux x64 with OpenSSL 3.0 and 3.5, macOS on Apple silicon and the browser; NativeAOT and browser smoke apps run in CI. The browser has hashes and HMAC only, so parsing and verifying work there and signing doesn’t.
Against the RFCs and against OpenSSL, Go, GnuPG and OpenSSH
The primitives run their RFC test vectors, and Wycheproof’s where it has them. The formats are exchanged both ways with OpenSSL 3.5.9: the CMS matrix has 169 passes, 0 failures and 20 cases OpenSSL can’t produce or open. Every parser has a fuzz target, each run for 600 seconds without a finding before this release.
Speed, as OneCrypto’s time ÷ the fastest managed .NET library’s for each row (mostly BouncyCastle 2.7.0), on x64: Ed25519 signing 0.55, X25519 0.76, Argon2 0.36, CMS signing 0.18, PKCS#12 loading 0.25. Three are documented exceptions: Camellia encrypts at about 2.3–2.4× and decrypts at about 1.1×, because it never indexes a table with secret data; AES key wrap on x64 at 1.53×, the platform’s per-call cost; and ECDSA P-256 verification at up to 1.70× on x64, because it calls the platform’s ECDSA. The x64 run is marked load-flagged.
The package
- OneCrypto
RecursiveAI.OneCrypto: everything on this page, in one package that depends only on .NET. Preview, 0.1.0-preview.1. - Not yet
OpenPGP; CAdES, XAdES and PAdES signatures; age, minisign and SSH signatures; PKCS#11, gpg-agent and ssh-agent keys; cloud key services; a command-line tool. Each is a planned package.
- .NET
.NET 10, C#. Written from the published specifications; other implementations are only compared against as programs. MIT or Apache-2.0.
Go further
This project is unaffiliated with other products named OneCrypto.