OpenSSL Commands Explained: Keys, CSRs, Certificates and PFX Files
The openssl commands you need for keys, CSRs, self-signed and CA certificates and PFX conversion, what each flag does, and which choices are weak.

Most developers use OpenSSL a few times a year: to request a certificate, to make one for local HTTPS, or to turn a Windows PFX file into something nginx can read. Each time, the commands have to be looked up again, and an old answer from a forum may use options that are weak today or that changed in OpenSSL 3. This guide covers the common tasks and shows how the OpenSSL Command Builder writes and explains the commands.
Private keys
Everything starts with a private key. The modern way is openssl genpkey, which handles every algorithm. For TLS, an EC key on the P-256 curve is small, fast and accepted by every browser and certificate authority. RSA with 3072 bits is the safe choice when an old client only speaks RSA; 2048 bits is still accepted but is planned to be phased out after 2030, and 1024 bits is broken. Ed25519 is excellent for signing but not yet accepted for public web certificates.
A key can be encrypted with a passphrase. That protects it at rest but means a server needs the passphrase to start. Unencrypted keys are normal for web servers, as long as the file is readable only by its owner.
Certificate signing requests
A CSR carries your public key and the names you want in the certificate. Browsers only look at the subject alternative names, not the common name, so a CSR without SANs leads to a certificate that Chrome, Firefox and Safari reject. With OpenSSL 1.1.1 and newer, the -addext option adds the SAN list directly on the command line. The builder also offers a config file route, which writes an openssl.cnf with a DN section and an alt_names list and works on every version.
The subject is written as /C=GB/O=Example Ltd/CN=www.example.com. The country must be a two-letter code, and slashes or equals signs inside a value need escaping, which the builder does for you.
Self-signed certificates and a private CA
For a single local site, openssl req -x509 creates a key and a self-signed certificate in one command. Keep the validity at 825 days or less, because Apple devices refuse longer TLS certificates even when you trust them.
If you have several local sites, a private CA is easier. Create one root certificate with basicConstraints CA:TRUE, trust it once on your machine, then sign a certificate for each site. In OpenSSL 3, openssl x509 -req with -copy_extensions copyall keeps the SANs from the CSR. In 1.1.1, those extensions are dropped, so the names have to be repeated in an extension file. The builder handles both versions and writes the extension file for you.
PFX and PEM conversion
Windows and Java often use PKCS#12 files, usually named .pfx or .p12, which bundle the key, the certificate and the chain behind a password. Linux servers expect separate PEM files. openssl pkcs12 converts both ways. Two points matter. First, include the intermediate chain when you create a PFX, or servers using it will send an incomplete chain. Second, OpenSSL 3 uses modern encryption by default; older Windows versions cannot open those files, and old files made with RC2 cannot be read by OpenSSL 3 without -legacy.
Never pass a password with pass:secret on the command line, because it ends up in your shell history and the process list. Use env:VARIABLE or file:path instead. The builder marks pass: as a weak choice.
Checking certificates
A few commands answer most questions. openssl x509 -noout -text shows every field; -dates and -ext subjectAltName show only what you usually need. openssl verify checks a certificate against a CA file and can test the host name. To confirm that a key matches its certificate, compare the SHA-256 hash of the public key from each file; the builder's match operation writes all three commands, including the CSR. openssl s_client connects to a live server, sends SNI with -servername and shows the chain the server returns.
Hashing and encrypting files
openssl dgst -sha256 prints a checksum, and -r gives the same format as sha256sum. For password-based file encryption, openssl enc needs -pbkdf2 and a high iteration count; without them the key is derived with a single hash and is easy to brute force. Note that enc does not detect tampering, so for files you share, tools such as age or gpg are a better fit.
Using the builder
Choose your OpenSSL version and shell, then add steps or load a recipe, for example the local development CA. Each step has a form, the command updates as you type, and a table below explains every flag in plain words. Weak choices are marked, and the whole recipe can be downloaded as a bash or PowerShell script with a comment above each step. The inspector tab reads a pasted certificate and shows its subject, issuer, validity, SANs and key type, which is a quick way to check the result.
The builder never runs OpenSSL itself and never sees your files. Read each command before running it, and keep private keys on the machine where they were created.



