| Crates.io | fastcert |
| lib.rs | fastcert |
| version | 0.3.1 |
| created_at | 2025-12-10 19:27:21.040782+00 |
| updated_at | 2025-12-11 07:22:12.71607+00 |
| description | A simple zero-config tool for making locally-trusted development certificates |
| homepage | https://github.com/ozankasikci/fastcert |
| repository | https://github.com/ozankasikci/fastcert |
| max_upload_size | |
| id | 1978635 |
| size | 349,352 |
A simple zero-config tool for making locally-trusted development certificates.
fastcert is a command-line tool that makes it easy to create and manage locally-trusted development certificates. It works by creating a local certificate authority (CA) and then generating certificates signed by that CA. The CA certificate is installed in your system's trust store, making all certificates it signs trusted by your browsers and development tools.
brew install ozankasikci/tap/fastcert
cargo install fastcert
git clone https://github.com/ozankasikci/fastcert
cd fastcert
cargo install --path .
This will install the fastcert binary to your cargo bin directory (usually ~/.cargo/bin).
For development or custom builds:
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# The binary will be in target/release/fastcert
macOS:
Linux:
certutil (NSS tools)
# Debian/Ubuntu
sudo apt install libnss3-tools
# Fedora/RHEL
sudo dnf install nss-tools
# Arch Linux
sudo pacman -S nss
Windows:
# Install local CA in system trust store
fastcert --install
# Generate certificate for a domain (RSA is the default)
fastcert example.com
# Generate certificate for multiple domains and IPs
fastcert example.com localhost 127.0.0.1 ::1
# Generate wildcard certificate
fastcert "*.example.com"
# Generate certificate with ECDSA keys (optional)
fastcert --ecdsa example.com
Note: RSA-2048 is the default key type. Use --ecdsa for ECDSA P-256 keys if needed.
Generate a certificate for a single domain:
fastcert example.com
This creates two files:
example.com.pem - the certificate (signed by the CA)example.com-key.pem - the private key (RSA-2048)Generate a certificate valid for multiple domains and IP addresses:
fastcert example.com localhost 127.0.0.1 ::1
The files will be named example.com+3.pem and example.com+3-key.pem (the +3 indicates 3 additional names beyond the first).
Note: Always include localhost and 127.0.0.1 if you want to access your service via localhost.
Generate a wildcard certificate:
fastcert "*.example.com"
Creates _wildcard.example.com.pem and _wildcard.example.com-key.pem.
Specify custom output file names:
fastcert --cert-file mycert.pem --key-file mykey.pem example.com
Generate a certificate with ECDSA keys instead of RSA:
fastcert --ecdsa example.com
ECDSA P-256 keys provide equivalent security to RSA-2048 with smaller key sizes, resulting in:
Both RSA and ECDSA are fully supported.
Generate a certificate for client authentication:
fastcert --client client.example.com
Generate a PKCS12 file (.pfx) containing both certificate and key:
fastcert --pkcs12 example.com
Or specify a custom PKCS12 file path:
fastcert --p12-file mycert.pfx example.com
Generate a certificate from an existing CSR:
fastcert --csr mycsr.pem --cert-file mycert.pem
View the CA certificate location:
fastcert --CAROOT
Install the CA in system trust stores:
fastcert --install
Uninstall the CA from system trust stores (but keep the certificate):
fastcert --uninstall
Set a custom CA location:
export CAROOT="$HOME/my-ca"
fastcert --install
Specify which trust stores to use:
export TRUST_STORES="system,firefox,java"
fastcert --install
Certificate Generation:
--cert-file FILE - Custom path for the certificate output file--key-file FILE - Custom path for the private key output file--p12-file FILE - Custom path for PKCS12 output file--client - Generate a certificate for client authentication--ecdsa - Use ECDSA P-256 keys instead of RSA-2048 (optional)--pkcs12 - Generate PKCS12 format (.pfx) file--csr FILE - Generate certificate from an existing CSRCA Management:
--install - Install the local CA in system trust stores--uninstall - Remove the local CA from system trust stores--CAROOT - Print the CA certificate storage locationOutput Control:
-v, --verbose - Enable verbose output--debug - Enable debug output (implies verbose)-q, --quiet - Suppress all output except errorsCAROOT: Set the directory where the CA certificate and key are stored. This allows you to maintain multiple independent CAs.
export CAROOT="$HOME/my-custom-ca"
fastcert --install
TRUST_STORES: Comma-separated list of trust stores to use. By default, fastcert auto-detects available stores.
Options:
system - Operating system trust storenss - Firefox and Chrome (via NSS)java - Java trust storeexport TRUST_STORES="system,nss"
fastcert --install
FASTCERT_VERBOSE:
Enable verbose output (same as --verbose).
FASTCERT_DEBUG:
Enable debug output (same as --debug).
FASTCERT_QUIET:
Suppress output except errors (same as --quiet).
All certificates generated by fastcert are valid for 825 days (approximately 2 years and 3 months), which is the maximum validity period accepted by major browsers.
RSA (default):
ECDSA (optional --ecdsa flag):
Both key types are fully supported. Choose based on your needs:
When you run fastcert --install, it creates a new local certificate authority and installs it in your system trust store. When you generate certificates, they are signed by this local CA, making them trusted by your system.
The CA certificate and key are stored in:
$HOME/.local/share/fastcert%LOCALAPPDATA%\fastcertYou can override this location by setting the CAROOT environment variable.
fastcert automatically detects and integrates with:
# Run all tests
cargo test
# Run specific test suite
cargo test --test integration
cargo test --test e2e
cargo test --test security
# Run with verbose output
cargo test -- --nocapture
# Generate code coverage report
cargo install cargo-tarpaulin
cargo tarpaulin --out Html --output-dir coverage
Problem: Browser shows "Not Secure" or certificate warning.
Solutions:
fastcert --install before generating certificateslocalhost 127.0.0.1 if accessing via localhostfastcert myapp.dev localhost 127.0.0.1 ::1openssl verify -CAfile "$(fastcert --CAROOT)/rootCA.pem" yourcert.pem
Problem: Error installing CA certificate.
Solutions:
sudo if installing system-wideProblem: Firefox shows certificate error even though system trusts it.
Solutions:
# Debian/Ubuntu
sudo apt install libnss3-tools
# macOS
brew install nss
fastcert --install againProblem: Java applications reject certificates.
Solutions:
fastcert --install to add CA to Java trust storeProblem: Want to recreate the CA.
Solution:
# Uninstall from trust stores
fastcert --uninstall
# Find CA location
fastcert --CAROOT
# Delete the CA directory
rm -rf $(fastcert --CAROOT)
# Reinstall
fastcert --install
Problem: Certificate generated for wrong domain.
Solution: Delete the certificate files and regenerate:
rm example.com*.pem
fastcert example.com
Problem: Need different CAs for different projects.
Solution: Use the CAROOT environment variable:
# Project 1
export CAROOT="$HOME/ca-project1"
fastcert --install
fastcert project1.local
# Project 2
export CAROOT="$HOME/ca-project2"
fastcert --install
fastcert project2.local
Problem: Certificate has expired.
Solution: Certificates are valid for 825 days. Simply regenerate:
fastcert example.com
Enable verbose or debug mode for detailed output:
fastcert --verbose example.com
fastcert --debug -install
No. fastcert is designed for development and testing only. Never use these certificates in production environments. The CA key is stored locally without additional protection, making it unsuitable for production use.
While technically possible, it's not recommended. For internal services, consider using a proper internal PKI solution. fastcert is best suited for local development.
Make sure:
fastcert --install before generating certificatesYes, but it's not recommended. You would need to copy the CA certificate to the other machine and install it manually. This defeats the purpose of a local CA and creates security risks.
If you lose the CA key, you cannot generate new trusted certificates. You'll need to:
fastcert --uninstall on all machines that trust the old CAfastcert --install to create a new CACertificates are valid for 825 days from creation. This is the maximum validity period accepted by major browsers and operating systems.
Currently, no. The validity period is fixed at 825 days to ensure browser compatibility.
Yes. You can mount the CA certificate into Docker containers and configure them to trust it. However, it's usually easier to use the container's hostname and generate a certificate for it.
Yes. fastcert is designed to be scriptable. Example:
#!/bin/bash
fastcert --install
for domain in app.local api.local db.local; do
fastcert "$domain"
done
Yes. You can generate certificates for IPv6 addresses:
fastcert ::1 2001:db8::1
No. Certificate revocation is not supported. If you need to invalidate a certificate, simply delete it and don't use it anymore.
The CA key is the most sensitive file. Keep it secure and never share it. If you suspect it has been compromised, you should uninstall the CA and delete the CAROOT directory.
Best Practices:
This project was inspired by mkcert.
BSD 3-Clause License - see LICENSE file for details
Active development - core functionality implemented