rsa

Pure Rust implementation of RSA encryption, signing, and key handling

Library
Cargo
v0.10.0-rc.18
673 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
45 /100 Fair
Development Activity 12
Maintenance 0
Community 80
Maturity 60
Momentum 28

Technical Analysis

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

The rsa crate is RustCrypto’s pure-Rust implementation of the RSA public-key cryptosystem, covering key generation, PKCS#1 v1.5 and PSS signing/verification, and OAEP/PKCS#1 v1.5 encryption. It has no dependency on OpenSSL or any other C cryptography library, making it straightforward to build and cross-compile, including to WASM and embedded targets.

As part of the broader RustCrypto organization, it composes with other RustCrypto traits crates (signature, digest, pkcs1, pkcs8) so it interoperates cleanly with the rest of the Rust cryptography ecosystem rather than reimplementing adjacent primitives itself. It also maintains a formal security policy and runs the Marvin Toolkit timing-side-channel test suite to catch RSA-specific timing leaks.

What You Get

  • RSA key generation, encoding, and decoding via PKCS#1 and PKCS#8 formats
  • PKCS#1 v1.5 and OAEP encryption/decryption schemes
  • PKCS#1 v1.5 and PSS signature schemes with support for multiple digest algorithms
  • A hazmat module exposing low-level primitives for advanced/custom use cases
  • Integration with the RustCrypto signature/digest trait ecosystem for composability
  • Wycheproof test-vector coverage and Marvin Toolkit timing-side-channel testing for security validation

Common Use Cases

  • Signing and verifying JWTs, certificates, or software artifacts using RSA-PSS or PKCS#1 v1.5
  • Encrypting small payloads (session keys, tokens) with RSA-OAEP for hybrid encryption schemes
  • Cross-compiling Rust cryptography code to WASM or embedded targets without linking OpenSSL
  • Interoperating with existing PKCS#1/PKCS#8-encoded RSA keys from other systems

Under The Hood

Architecture - The crate is organized around key.rs (key generation and representation), pkcs1v15.rs/pkcs1v15/ and pss.rs/pss/ for the two signature schemes, oaep.rs/oaep/ for OAEP encryption, and hazmat.rs for exposing raw primitives to advanced callers who need to build custom padding schemes on top. traits.rs/traits/ define the public interfaces that tie into RustCrypto’s shared signature and digest crates so rsa keys can be used anywhere those traits are expected.

Tech Stack - Pure Rust, no C dependencies; built on crypto-bigint (RustCrypto’s constant-time bignum arithmetic), crypto-primes for prime generation, signature/digest for algorithm-agnostic signing interfaces, and optional pkcs1/pkcs8/serdect integrations for encoding and serde support.

Code Quality - The tests/ directory includes a Wycheproof test-vector suite (wycheproof.rs) — a well-known cross-language cryptographic test corpus — plus dedicated PKCS#1/PKCS#8 encoding tests and property-based tests (proptests.rs) with recorded regression cases. The repo additionally ships a marvin-toolkit/ directory for RSA-specific timing-side-channel analysis and a documented SECURITY.md policy, both unusual and valuable additions for a cryptography crate.

API Design - The API separates high-level, safe-by-default operations (key generation, standard OAEP/PSS/PKCS#1 encrypt-sign-verify calls) from the explicitly-named hazmat module for low-level primitives, signaling clearly to callers which surface requires expert judgment to use safely — a common and appropriate pattern for cryptography libraries.

Used by 5 apps in this directory

Rust
52%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,607

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 52%
Python 48%
Updated 4 days ago
Dart
80%
Apache 2.0

LocalSend

Networking

92,857

An open-source, cross-platform AirDrop alternative that sends files and messages device-to-device over your local network with no internet, no account, and no cloud server involved.

View details
89
Repo Health
61
Technical
78
Dependency
Built with
Dart 80%
Rust 17%
Updated 5 days 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
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