rustls-pki-types

Shared, dependency-free types for X.509 certificates and keys in the rustls ecosystem

Library
Cargo
v1.15.1
40 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
51 /100 Fair
Development Activity 40
Maintenance 64
Community 28
Maturity 52
Momentum 20

Technical Analysis

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

rustls-pki-types is a small crate defining common types for representing X.509 certificates, private keys, DNS/server names, and other PKI primitives shared across the rustls ecosystem — rustls, rustls-webpki, rcgen, and others. Before this crate existed, each of those crates defined its own trivial DER-bytes wrapper, which created unnecessary, incompatible dependency edges between otherwise-related crates.

By centralizing these types with a long-term-stable API and zero required dependencies, downstream crates can interoperate without forcing consumers to convert between near-identical types. The crate deliberately does not implement Clone on private-key types to reduce accidental exposure of key material in memory, offering clone_key() or Rc/Arc wrapping instead, and supports no_std environments with optional alloc support.

What You Get

  • Types for DER-encoded certificates, private keys, and certificate revocation lists shared across the rustls crate family
  • PEM parsing/encoding support alongside the primary DER representation
  • A ServerName type for representing and validating TLS server names (DNS names, IP addresses)
  • no_std compatibility with an optional alloc feature, plus a web feature for WASM targets via web-time
  • Security-conscious private key handling: no Clone impl on key types, with an explicit clone_key() method instead

Common Use Cases

  • Passing certificates and private keys between rustls and companion crates (rustls-webpki, tokio-rustls, rcgen) without manual type conversion
  • Building custom TLS tooling or certificate-management utilities that need to interoperate with the rustls ecosystem’s types
  • Embedded or no_std Rust projects needing PKI types without pulling in a full TLS stack
  • WASM-targeted applications needing certificate/name types via the web feature

Under The Hood

Architecture - The crate is organized around a handful of focused modules: server_name.rs defines ServerName and its DNS/IP-address validation logic, pem.rs and base64.rs handle PEM encoding/decoding on top of the DER primitives, alg_id.rs defines algorithm-identifier constants used in X.509 structures, and lib.rs ties together the core certificate/key newtypes. A src/data/ directory holds .der-format test fixtures used across the test suite. The design goal is explicitly interoperability: these types exist so rustls, rustls-webpki, and similar crates share one vocabulary instead of each defining incompatible DER wrappers.

Tech Stack - Pure Rust (100% of the repo), edition 2021, minimum Rust version 1.60 for broad compatibility, with zeroize as the only (optional, alloc-gated) dependency for securely wiping key material from memory, and web-time optionally pulled in for WASM targets via the web feature. Dual-licensed MIT OR Apache-2.0, matching the wider rustls project’s licensing.

Code Quality - Four dedicated test files (key_type.rs, server_name.rs, dns_name.rs, pem.rs) cover the crate’s core types, backed by real .der/key fixture data under tests/data and tests/keys. The repo lints with elided_lifetimes_in_paths = "warn" in Cargo.toml, and includes a deny.toml for cargo-deny dependency/license auditing plus a fuzz/ directory for fuzz testing PEM/DER parsing — an appropriate quality bar for a crate that parses untrusted certificate data.

API Design - Because this crate’s entire purpose is to be a stable, minimal dependency shared by many other crates, its API surface is intentionally small and conservative — new breaking changes are rare given how many downstream crates (rustls, webpki, rcgen) would need to co-release. The choice to omit Clone from private key types and instead require an explicit clone_key() call is a deliberate ergonomic trade-off that nudges callers toward Rc/Arc sharing rather than silently duplicating sensitive key material.

Used by 5 apps in this directory

TypeScript
88%
MIT

Mistle

AI Agents · Developer Tools

93

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

View details
68
Repo Health
76
Technical
70
Dependency
Built with
TypeScript 88%
Rust 11%
Updated 2 months ago
Go
81%
AGPL 3.0

PeerDB

Data Engineering · Databases

3,288

Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
Go 81%
TypeScript 12%
Updated 4 days ago
Rust
90%
Apache 2.0

Qdrant

AI Development · Databases · Search

34,857

Open-source vector database and search engine built in Rust for production-grade AI applications — from semantic search to RAG pipelines and recommendation systems.

View details
92
Repo Health
87
Technical
65
Dependency
Built with
Rust 90%
Updated 5 days ago
Rust
98%

Stalwart

Collaboration

14,848

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
89
Repo Health
81
Technical
65
Dependency
Built with
Rust 98%
Updated 5 days ago
Rust
64%
Apache 2.0

Temps

Analytics · Devops · Monitoring

801

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
70
Dependency
Built with
Rust 64%
TypeScript 34%
Updated 4 days ago

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