Run rcgen on rind
This page describes rind-rcgen as main has it, ahead of rind-rcgen 0.14.3 on crates.io. Until its next release, take it from git at the commit this page describes. Beside the lines below, add this line under the [patch.crates-io] table of your workspace's root Cargo.toml (add the table if it has none), then run cargo update -p rind-rcgen:
rind-rcgen = { git = "https://github.com/kixel-ai/rind", rev = "80fc7ba544b53a6ca9ab21ba9a946c275eb19a06" }That moves every crate in your tree that depends on rind-rcgen, and cargo tree -i rind-rcgen then shows it from git+https://github.com/kixel-ai/rind.
This crate provides rcgen's KeyPair for rcgen, backed by rind, a fork of Graviola.
It generates and loads ECDSA P-256 and P-384 and Ed25519 keys, and loads RSA keys.
Build rcgen with default-features = false so it compiles no other crypto backend:
[dependencies]
rcgen = { version = "0.14", default-features = false }
rind-rcgen = "0.14"Then use rind_rcgen::KeyPair where rcgen's crypto feature would give rcgen::KeyPair.
Without that feature, rcgen needs each certificate's serial number set explicitly,
and leaves its key identifiers empty unless key_identifier_method is set.
use rind_rcgen::KeyPair;
let key = KeyPair::generate()?;
let mut params = rcgen::CertificateParams::new(["localhost".to_string()])?;
params.serial_number = Some(rcgen::SerialNumber::from(1));
let cert = params.self_signed(&key)?;
let key = key.serialize_der();What rind cannot back
KeyPair behaves as rcgen's on its ring backend, which is rcgen's default:
- No P-521 or ML-DSA keys, and no
KeyPair::generate_rsa_fororRsaKeySize, which rcgen offers only withaws_lc_rs. - RSA keys load but do not generate:
generate_forreturnsKeyGenerationUnavailable. - Only PKCS#8 private keys load, not SEC1 or PKCS#1.
- An unsupported algorithm returns
UnsupportedSignatureAlgorithmwhere rcgen panics.
The pem feature, on by default as rcgen's is, adds the PEM methods.
Keys and the key pair's PKCS#8 copy are wiped on drop.
The zeroize feature, as rcgen's, implements Zeroize for KeyPair, clearing its PKCS#8 copy.
WebAssembly
It builds for wasm32-wasip2 and wasm32-unknown-unknown, the browser, where
rind needs its JavaScript random source, getrandom = { version = "0.4", features = ["wasm_js"] }. PLATFORMS.md lists what each adapter's
upstream needs there too, and why rind's constant-time checks do not cover wasm.
Switch with an agent
Paste this into your coding agent, in your repository:
Move this repository from ring or aws-lc-rs to rind, following
https://raw.githubusercontent.com/kixel-ai/rind/main/MIGRATE.mdIt migrates on a local branch, reports the build time, binary size, benchmarks, and tests before and after, and asks before opening a PR or filing an issue. To migrate by hand, MIGRATING.md maps each ring and aws-lc-rs item to rind's.