Generate a certificate signing request to send to a certificate authority, or a self-signed certificate for a local HTTPS server, along with the private key that belongs to it. The key, the request and the certificate are built with the WebCrypto API and encoded as standard PEM, so they open in openssl, nginx, Apache, Node, and every language’s TLS library.
What a CSR contains
A PKCS#10 certificate signing request has three parts: the subject (who the certificate is for), the public key, and a signature made with the matching private key. The signature proves to the CA that whoever submitted the request also holds the private key. Extensions requested by the applicant, such as subject alternative names, travel inside an attribute called extensionRequest.
The CA copies what it accepts from the request into the certificate it issues. Public CAs ignore most of the subject (they verify the domain, not your organization name) and read the hostnames from the SAN list, so the SAN field is the part worth getting right.
Subject vs subject alternative names
The subject fields (CN, O, OU, L, ST, C, email) are human-readable labels. The subject alternative name extension is what a browser or TLS client matches against the hostname it connected to. Chrome stopped reading the common name for hostname matching in version 58 (Chromium blog, 2017), and Firefox and Safari behave the same way. A certificate with CN=localhost and no SAN fails in every current browser.
The SAN field takes a comma-separated list. localhost, 127.0.0.1, ::1, *.dev.test becomes two IP entries and two DNS entries; the hint under the field shows how each item was read. A wildcard such as *.dev.test covers one label, so it matches api.dev.test but not a.b.dev.test. Entries that are neither a hostname nor an IP are dropped rather than written into the file.
Choosing the key
| Key | Size | When |
|---|---|---|
| ECDSA P-256 | 256-bit curve | The default. Smallest key, fastest handshake, universal support. |
| ECDSA P-384 | 384-bit curve | Policies that require 192-bit security strength. |
| RSA 2048 | 2048-bit modulus | Older appliances, Java keystores, or anything that rejects EC keys. |
| RSA 3072 | 3072-bit modulus | RSA where 2048 is considered too short for the certificate’s lifetime. |
| RSA 4096 | 4096-bit modulus | Rarely needed; generation takes several seconds and every handshake does more work. |
The signature hash defaults to SHA-256. SHA-384 is the conventional pairing for P-384. SHA-1 is not offered: browsers have rejected SHA-1 signatures since 2017.
Self-signed certificates for local HTTPS
Switch to Self-signed to skip the CA. The certificate is signed with its own key, the issuer equals the subject, and it carries basicConstraints, keyUsage and extendedKeyUsage set for a TLS server (serverAuth and clientAuth). Set the validity in days; browsers reject certificates that last longer than 398 days when a public CA issues them, and Safari applies the same limit to certificates trusted through the system store, so 365 is a safe value for a development machine.
Browsers warn about a self-signed certificate because its issuer is not in any trust store. To silence the warning on your own machine, import cert.pem into the system or browser trust store as a trusted root, or tick Certificate authority to mint a local CA and sign server certificates with it using openssl.
The equivalent openssl command
The command pane shows the single openssl req invocation that produces the same output from the same settings:
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \
-keyout key.pem -sha256 -x509 -days 365 -out cert.pem \
-subj "/CN=localhost" -addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
Drop -x509 -days 365 and change -out to csr.pem for a request instead of a certificate. The -addext flag needs OpenSSL 1.1.1 or later; older releases read the extension from a config file instead.
Decode and convert
The Decode / JWK mode reads one PEM block and reports what is inside: subject and issuer, serial number, validity window and whether it has passed, key algorithm and size, the CA flag, SAN list and SHA-256 fingerprint. A certificate request is verified against its own signature. The key inside is exported as a JSON Web Key for JWT libraries and JWKS endpoints, and the raw DER bytes are shown as Base64 and as hex for comparing with another copy of the file.
Limits
- The output is a request or a self-signed certificate, never a CA-issued one. Send the CSR to a CA for that.
- No PKCS#12 (
.pfx) bundles. Combine the key and certificate withopenssl pkcs12 -exportwhen a Windows or Java server needs one. - Legacy
RSA PRIVATE KEYandEC PRIVATE KEYblocks and encrypted keys are not decoded. Convert them to PKCS#8 withopenssl pkeyfirst. - Keep
key.pem. The CSR and certificate are useless without the private key they were made from, and the key is not stored anywhere once the page is closed.