npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

sslkit

v1.1.2

Published

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.

Readme

SSLKit

English | 简体中文

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.

Features

  • 🔄 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

Supported Formats

| 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 |

Prerequisites

  • OpenSSL: Required for all operations
  • Java JDK: Required only for JKS format conversion (keytool)

Installation of Prerequisites

macOS:

# OpenSSL (usually pre-installed)
brew install openssl

# Java (for JKS)
brew install openjdk

Ubuntu/Debian:

# OpenSSL
sudo apt-get install openssl

# Java (for JKS)
sudo apt-get install default-jdk

Windows:

Installation

npm install -g sslkit

Or use with npx (no installation required):

npx sslkit [options]

Usage

Basic Command

sslkit -m <mode> -d <directory> [options]

Options

| 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

1. Generate PFX from PEM + KEY

# 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)

2. Generate PEM from PFX

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. Generate CRT for Apache

sslkit -m crt -d ./certs -o apache_cert

Output:

  • apache_cert.crt (certificate)
  • apache_cert.key (private key)

4. Generate JKS for Tomcat

sslkit -m jks -d ./certs -p keystorePassword -o tomcat_keystore

Output:

  • tomcat_keystore.jks
  • jks-password.txt (contains the password)

Server Configuration Examples

Nginx (PEM)

server {
    listen 443 ssl;
    server_name example.com;

    ssl_certificate /path/to/certificate.pem;
    ssl_certificate_key /path/to/certificate.key;
}

Apache (CRT)

<VirtualHost *:443>
    ServerName example.com

    SSLEngine on
    SSLCertificateFile /path/to/certificate.crt
    SSLCertificateKeyFile /path/to/certificate.key
</VirtualHost>

Tomcat (PFX)

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    keystoreFile="/path/to/certificate.pfx"
    keystorePass="yourPassword"
    keystoreType="PKCS12"
    clientAuth="false" sslProtocol="TLS"/>

Tomcat (JKS)

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    keystoreFile="/path/to/keystore.jks"
    keystorePass="yourPassword"
    keystoreType="JKS"
    clientAuth="false" sslProtocol="TLS"/>

How It Works

Conversion Flows

  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

File Detection

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 encodings

Development

Build from Source

# Clone repository
git clone https://github.com/Alioth1017/sslkit.git
cd sslkit

# Install dependencies
pnpm install

# Build
pnpm build

# Test
pnpm test

Project Structure

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

OpenSSL not found

# Check if OpenSSL is installed
openssl version

# If not, install it (see Prerequisites section)

Keytool not found (for JKS)

# Check if Java is installed
java -version
keytool -help

# If not, install Java JDK (see Prerequisites section)

Permission denied

# Make sure you have read/write permissions in the target directory
chmod 755 /path/to/cert/directory

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

ISC

Author

Alioth

Keywords

  • SSL certificate
  • certificate conversion
  • PEM
  • PFX
  • CRT
  • JKS
  • OpenSSL
  • certificate management
  • keystore
  • web server configuration