A powerful CLI tool for converting and managing SSL certificates across different formats (PEM, PFX, CRT, JKS). Perfect for Nginx, Apache, Tomcat, IIS, and more.
npm install sslkitEnglish | įŽäŊ䏿
A powerful command-line tool for converting and managing SSL certificates across different formats. Easily convert between PEM, PFX, CRT, and JKS formats for various web servers and applications.
- đ Multiple Format Support: Convert between PEM, PFX, CRT, and JKS formats
- đĨī¸ Server Compatibility: Generate certificates for Nginx, Apache, Tomcat, IIS, and more
- â
Smart Detection: Automatically detects and processes certificate files
- đ Pre-flight Checks: Validates dependencies and inputs before processing
- đĄī¸ Secure: Password protection for generated keystores
| Format | Use Case | Servers |
| ------- | -------------------- | ---------------------------- |
| PEM | Nginx, general use | Nginx, most Unix servers |
| PFX | Windows servers, IIS | IIS, Tomcat, Windows |
| CRT | Apache servers | Apache, various Unix servers |
| JKS | Java applications | Tomcat, Java applications |
- OpenSSL: Required for all operations
- Java JDK: Required only for JKS format conversion (keytool)
macOS:
``bashOpenSSL (usually pre-installed)
brew install openssl
Ubuntu/Debian:
`bash
OpenSSL
sudo apt-get install opensslJava (for JKS)
sudo apt-get install default-jdk
`Windows:
- Download OpenSSL from https://slproweb.com/products/Win32OpenSSL.html
- Download Java JDK from https://www.oracle.com/java/technologies/downloads/
Installation
`bash
npm install -g sslkit
`Or use with npx (no installation required):
`bash
npx sslkit [options]
`Usage
$3
`bash
sslkit -m -d [options]
`$3
| Option | Alias | Description | Default |
| -------------------- | ----- | ------------------------------------------------ | ------------- |
|
--mode | -m | Certificate format to generate (pem/pfx/crt/jks) | pfx |
| --directory | -d | Directory containing certificate files | . |
| --export-password | -p | Password for the generated file | 123456 |
| --output-file-name | -o | Output file name (without extension) | certificate |
| --openssl-path | - | Path to OpenSSL binary | openssl |
| --version | -V | Show version number | - |
| --help | -h | Show help | - |Examples
$3
`bash
Place your certificate.pem and private.key in a directory
sslkit -m pfx -d ./certs -p mySecurePassword -o server
`Output:
-
server.pfx
- pfx-password.txt (contains the password)$3
`bash
sslkit -m pem -d ./certs -p myPassword -o nginx_cert
`Output:
-
nginx_cert.pem (certificate)
- nginx_cert.key (private key)
- nginx_cert_combined.pem (certificate + key in one file)$3
`bash
sslkit -m crt -d ./certs -o apache_cert
`Output:
-
apache_cert.crt (certificate)
- apache_cert.key (private key)$3
`bash
sslkit -m jks -d ./certs -p keystorePassword -o tomcat_keystore
`Output:
-
tomcat_keystore.jks
- jks-password.txt (contains the password)Server Configuration Examples
$3
`nginx
server {
listen 443 ssl;
server_name example.com; ssl_certificate /path/to/certificate.pem;
ssl_certificate_key /path/to/certificate.key;
}
`$3
`apache
ServerName example.com SSLEngine on
SSLCertificateFile /path/to/certificate.crt
SSLCertificateKeyFile /path/to/certificate.key
`$3
`xml
maxThreads="150" scheme="https" secure="true"
keystoreFile="/path/to/certificate.pfx"
keystorePass="yourPassword"
keystoreType="PKCS12"
clientAuth="false" sslProtocol="TLS"/>
`$3
`xml
maxThreads="150" scheme="https" secure="true"
keystoreFile="/path/to/keystore.jks"
keystorePass="yourPassword"
keystoreType="JKS"
clientAuth="false" sslProtocol="TLS"/>
`How It Works
$3
1. PFX Generation: PEM + KEY â PFX
2. PEM Generation: PFX â PEM + KEY
3. CRT Generation: PEM/PFX â CRT + KEY
4. JKS Generation: PFX/PEM+KEY â JKS
$3
SSLKit automatically detects certificate files in the specified directory:
- Searches for
.key, .pem, .pfx, .crt, .cer files
- Validates file content using regex patterns
- Supports various certificate formats and encodingsDevelopment
$3
`bash
Clone repository
git clone https://github.com/Alioth1017/sslkit.git
cd sslkitInstall dependencies
pnpm installBuild
pnpm buildTest
pnpm test
`$3
`
sslkit/
âââ src/
â âââ cli.ts # CLI entry point
â âââ index.ts # Main library
â âââ utils.ts # Utility functions
â âââ validator.ts # Input validation
â âââ certificate-generator/
â âââ base.ts # Base generator class
â âââ pem-generator.ts # PEM generator
â âââ pfx-generator.ts # PFX generator
â âââ crt-generator.ts # CRT generator
â âââ jks-generator.ts # JKS generator
âââ dist/ # Compiled output
âââ package.json
âââ README.md
`Troubleshooting
$3
`bash
Check if OpenSSL is installed
openssl versionIf not, install it (see Prerequisites section)
`$3
`bash
Check if Java is installed
java -version
keytool -helpIf not, install Java JDK (see Prerequisites section)
`$3
`bash
Make sure you have read/write permissions in the target directory
chmod 755 /path/to/cert/directory
``Contributions are welcome! Please feel free to submit a Pull Request.
ISC
Alioth
- SSL certificate
- certificate conversion
- PEM
- PFX
- CRT
- JKS
- OpenSSL
- certificate management
- keystore
- web server configuration