rcgen

A pure-Rust library for generating X.509 certificates, CSRs, and CRLs, including self-signed certs in a few lines of code.

Library
Cargo
v0.14.10
510 stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
84 /100 Excellent
Development Activity 92
Maintenance 72
Community 84
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
77 /100 Good
Architecture 80
Code Quality 82
Innovation 72
Learning Curve 75

rcgen is a Rust library for generating X.509 certificates, certificate signing requests (CSRs), and certificate revocation lists (CRLs) without shelling out to OpenSSL. It ships high-level helpers like generate_simple_self_signed for the common case of a self-signed certificate covering a set of subject alternative names, while also exposing lower-level Certificate, CertificateParams, KeyPair, and Issuer types for building certificate chains, custom extensions, and CA hierarchies.

Maintained under the rustls GitHub organization, rcgen is widely used as the certificate-generation backbone for local development tooling (mkcert-style workflows), test fixtures for TLS libraries, and QUIC/rustls-based servers that need to mint certificates on the fly. The workspace also includes rustls-cert-gen, a small CLI built on top of rcgen for generating certificates from the command line.

What You Get

  • A one-line generate_simple_self_signed helper that produces a self-signed certificate for a list of subject alternative names, returning both the certificate and its signing key.
  • Lower-level CertificateParams, Certificate, Issuer, and KeyPair types for constructing CA hierarchies, custom distinguished names, key usages, and extensions.
  • Certificate signing request (CSR) generation and parsing via the csr module, plus certificate revocation list (CRL) generation via the crl module.
  • Pluggable cryptography backends (ring or aws-lc-rs) selected via Cargo features, so consumers can match whichever crypto provider their project already depends on.
  • A companion rustls-cert-gen CLI crate in the same workspace for generating certificates directly from the command line without writing Rust code.

Common Use Cases

  • Generating a throwaway self-signed TLS certificate for local development servers, similar to mkcert.
  • Minting test certificates and CA chains in the test suite of a TLS/QUIC library or application (as quinn and other rustls-ecosystem crates do).
  • Building a lightweight internal CA that issues short-lived certificates for services or devices at runtime.
  • Generating CSRs and CRLs programmatically as part of a certificate-management or PKI automation pipeline.

Under The Hood

Architecture: The crate centers on CertificateParams (subject alt names, distinguished name, key usages, extensions) which is combined with a KeyPair and, for non-self-signed certs, an Issuer to produce a signed Certificate (see src/certificate.rs, 1500+ lines). src/csr.rs and src/crl.rs implement the parallel CSR and CRL flows on the same underlying types, and src/sign_algo.rs abstracts over the supported signature algorithms so the rest of the crate doesn’t need to special-case RSA vs. ECDSA vs. Ed25519. src/ring_like.rs isolates the thin shim between the two supported crypto backends.

Tech Stack: Rust 2021 edition, MSRV policy targeting Rust releases roughly 7 months old (currently 1.88). Core dependencies are yasna (ASN.1/DER encoding), pem (PEM encoding), time (validity periods), x509-parser (parsing), and a choice of ring or aws-lc-rs for the actual cryptographic signing, selected via Cargo features so consumers aren’t forced onto a crypto backend they don’t already use elsewhere in their dependency tree.

Code Quality: The workspace includes a dedicated verify-tests crate whose job is to round-trip rcgen’s output through OpenSSL, x509-parser, and other independent implementations to catch encoding bugs that unit tests alone might miss; individual modules also carry inline #[test] coverage. codecov.yml indicates CI-tracked coverage, and the crate has a strong track record as a dependency of security-sensitive projects (rustls, quinn) that would surface regressions quickly.

API Design: The generate_simple_self_signed(names) -> CertifiedKey { cert, signing_key } entry point covers the common case in a single call and is prominently demonstrated in the README, while CertificateParams/Issuer give escape hatches for CA chains and custom extensions without requiring a different crate. PEM/DER output methods are attached directly to the returned types (cert.pem(), signing_key.serialize_pem()), minimizing the boilerplate needed to get a usable certificate.

Used by 7 apps in this directory

Go
69%
MIT

hoop

Monitoring · Security

836

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
86
Repo Health
80
Technical
64
Dependency
Built with
Go 69%
Clojure 13%
Updated today
TypeScript
88%
MIT

Mistle

AI Agents · Developer Tools

95

Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.

View details
50
Repo Health
76
Technical
70
Dependency
Built with
TypeScript 88%
Rust 11%
Updated 3 weeks ago
Rust
87%
Apache 2.0

OpenShell

AI Agents · Developer Tools

18,930

The safe, private runtime that lets autonomous AI agents operate in sandboxed environments governed by declarative YAML policies — blocking data exfiltration, credential leaks, and unauthorized network activity before they happen.

View details
84
Repo Health
81
Technical
67
Dependency
Built with
Rust 87%
Updated today
Rust
98%

Stalwart

Collaboration

15,268

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
88
Repo Health
81
Technical
65
Dependency
Built with
Rust 98%
Updated 4 days ago
Rust
66%
Apache 2.0

Temps

Analytics · Devops · Monitoring

865

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
66
Dependency
Built with
Rust 66%
TypeScript 33%
Updated yesterday
Rust
79%
Apache 2.0

TensorZero

Ab Testing Experimentation · AI Development · Monitoring

11,708

TensorZero unifies the LLM gateway, observability, evaluation, optimization, and experimentation stack behind a single OpenAI-compatible API, built in Rust for sub-millisecond p99 latency.

View details
53
Repo Health
87
Technical
68
Dependency
Built with
Rust 79%
TypeScript 15%
Updated 4 months ago
Rust
33%
Other

Windmill

Automation · Developer Tools

18,257

Turn scripts into webhooks, workflows, and auto-generated UIs — the fastest self-hostable workflow engine, 13x faster than Airflow.

View details
91
Repo Health
82
Technical
64
Dependency
Built with
Rust 33%
TypeScript 24%
Svelte 22%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers