🔨 Forge
A fast, reliable Rust-based CLI tool for converting PFX/P12 certificate files to PEM format. Forge provides a modern, user-friendly interface with beautiful output formatting and comprehensive error handling.
✨ Features
- 🔐 Secure Conversion: Convert PFX/P12 files to PEM format with OpenSSL
- 🔑 Password Support: Handle password-protected certificate files
- 🔗 Certificate Chains: Extract and save complete certificate chains
- 📁 Flexible Output: Customizable output directories and filenames
- 🎨 Beautiful CLI: Colorized output with progress indicators and formatted tables
- ⚡ Fast & Reliable: Built in Rust for performance and safety
📦 Installation
Pre-built Binaries
Download the latest release for your platform from the releases page:
Note for Windows users: Pre-built Windows binaries include OpenSSL statically linked, so no additional OpenSSL installation is required.
# Linux (x86_64) - replace {version} with the latest version (e.g., 0.1.1)
|
# macOS (Intel) - replace {version} with the latest version
|
# macOS (Apple Silicon) - replace {version} with the latest version
|
# Windows
# Download forge-windows-x86_64-{version}.zip from the releases page and extract forge.exe
# No additional OpenSSL installation required!
Or use these one-liners that automatically fetch the latest version:
# Linux (x86_64)
|
# macOS (Intel)
|
# macOS (Apple Silicon)
|
Docker
# Run directly
# Pull the image
Cargo Install
If you have Rust installed, you can install forge directly from crates.io or from the Git repository:
# Install from crates.io
# Install from Git repository (latest development version)
# Install a specific version from Git
From Source
Requires Rust 1.85+ and OpenSSL development libraries:
# Install dependencies (Ubuntu/Debian)
&&
# Install dependencies (macOS)
# Install dependencies (Windows)
# Option 1: Use vcpkg (recommended)
# Option 2: Download and install OpenSSL from https://slproweb.com/products/Win32OpenSSL.html
# Then set environment variables:
# set OPENSSL_DIR=C:\Program Files\OpenSSL-Win64
# Build and install
Windows Note: When building from source on Windows, you'll need OpenSSL development libraries. The vcpkg method is recommended as it provides static libraries that don't require runtime dependencies.
🚀 Usage
Basic Usage
# Convert a PFX file (no password)
# Convert with password
# Specify output directory
Advanced Options
# Create combined PEM file (private key + certificate)
# Extract certificate chain
# Custom filenames
# Verbose output with detailed information
Complete Example
This will:
- Convert
certificate.pfxusing password "mypassword" - Save all files to
./output/directory - Create a combined PEM file with private key and certificate
- Extract the complete certificate chain
- Show detailed progress and certificate information
📋 Command Line Options
| Option | Description | Default |
|---|---|---|
--pfx |
Path to the PFX/P12 certificate file | Required |
--password |
Password for the PFX file | Empty string |
--out |
Output directory for PEM files | Current directory |
--combined |
Create combined PEM file (key + cert) | false |
--chain |
Extract complete certificate chain | false |
--key-file |
Custom private key filename | private_key.pem |
--cert-file |
Custom certificate filename | certificate.pem |
--combined-file |
Custom combined file filename | certificate_with_key.pem |
--verbose |
Enable verbose output | false |
📁 Output Files
Forge generates the following files based on your options:
private_key.pem- Private key in PKCS#8 PEM formatcertificate.pem- Main certificate in PEM formatcertificate_with_key.pem- Combined file (if--combinedis used)certificate_chain.pem- Complete chain (if--chainis used)chain_cert_N.pem- Individual chain certificates (if--chainis used)
🔧 Development
Prerequisites
- Rust 1.85+
- OpenSSL development libraries
- Git
Building
# Development build
# Release build
# Run tests
# Run with example
Testing
# Run all tests
# Run with output
# Run integration tests only
# Run with coverage (requires cargo-tarpaulin)
Code Quality
# Format code
# Lint code
# Security audit
🐳 Docker Development
# Build Docker image
# Run in container
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.