Browser-based CSR generator · the private key is created here and never sent

CSR Generator

Create an RSA or elliptic-curve key pair in your browser, fill in the subject and names, and get a signed PKCS#10 request in PEM plus the private key in PKCS#8. The request is assembled byte by byte here and signed with the new key. You can also paste an existing request to read it back.

Subject

Public CAs usually ignore everything except the names below and the key, and fill in the organization themselves after validation.

Names and key

CSR Generator for RSA and ECDSA Keys with SANs

Operator: Abdulla Al Fahad. How tools are built and checked

For a subject of C=BD, ST=Dhaka, L=Dhaka, O=Example Ltd and CN=www.example.com, with the extra names example.com and *.example.com and a P-256 key, the finished certificate request is 358 bytes of DER, ten lines of PEM, and passes openssl req -verify. The same subject on a 2048-bit RSA key is 751 bytes and eighteen lines, and on a 4096-bit key 1,263 bytes.

The request is assembled field by field in the browser: subject, public key, the subject alternative names as an extension request, then a signature made with the private key that was just generated. The private key is returned as PKCS#8 PEM. A second mode reads an existing request and checks that its signature matches the key inside it, which is useful when a certificate authority says a CSR it received is invalid.

Key features

  • RSA 2048, 3072 and 4096-bit keys with SHA-256, and ECDSA with the curves P-256, P-384 and P-521, signed with SHA-256, SHA-384 and SHA-512
  • Subject fields written in the usual order: country, state, locality, organization, unit, common name, e-mail
  • Subject alternative names for DNS names, wildcards, IPv4 and IPv6 addresses and e-mail addresses, checked before signing
  • The common name added to the SAN list on request, since browsers ignore the common name
  • PEM CSR and PKCS#8 private key, each with Copy and Download, and an OpenSSL command to double-check the result
  • A decode mode showing subject, key, signature algorithm and requested names, and verifying the self-signature

What goes into the request and how it is signed

A PKCS#10 request holds a version number (always 0, shown as v1), the subject name, the public key as a SubjectPublicKeyInfo, and a set of attributes. This tool places the names in the extensionRequest attribute as a subjectAltName extension, which is what certificate authorities read. The signature covers the first three parts plus the attributes and is stored as a bit string. The signing algorithm is sha256WithRSAEncryption for RSA and ecdsa-with-SHA256, SHA384 or SHA512 for the three curves, matched to the curve size.

Names are validated before any key is generated. A DNS name must use letters, digits, hyphens and underscores in labels of at most 63 characters, and a wildcard is accepted only as the whole left-most label, as in *.example.com. Non-ASCII names must be written in their xn-- form. IP addresses are parsed as IPv4 or IPv6 and stored as 4 or 16 bytes. A subject field may not exceed 64 characters, the country must be two letters (written as a PrintableString) and the other text fields are UTF8Strings. Up to 100 names are accepted.

How it works

WebCrypto generates the key pair and exports the public key as SPKI and the private key as PKCS#8. The request is built in memory from DER pieces, with ECDSA signatures converted from WebCrypto's raw r and s form to the DER sequence a request must carry.

Decoding reverses the process with a DER reader: it extracts the subject, key and names, then verifies the signature over the request information against the key in the request, for RSA with PKCS#1 v1.5 padding and for ECDSA with the NIST curves.

Typical uses

  • A wildcard certificate is ordered for *.example.com and example.com with a P-256 key: both names go into the SAN list, and the CA's validation page accepts the CSR on the first try.
  • A CA's portal says 'invalid signature' for a CSR produced years ago by an appliance, and the decode mode confirms the self-signature fails, so a new request is needed.

Building one

  1. Choose the key type, fill in the common name and any other subject fields, and list the names, one per line.
  2. Press Generate key and CSR; an RSA 4096 key can take several seconds.
  3. Download the .csr and the .key, and store the key before closing the page: it is not saved anywhere.
  4. Open Decode a CSR, paste the request, and confirm the names and the self-signature, or run openssl req -in request.csr -noout -text -verify.
  5. Send only the CSR to the certificate authority.

Example

Subject, names and key

Common name www.example.com, organization Example Ltd, locality and state Dhaka, country BD
Names: example.com and *.example.com, common name added to the SAN list
Key: ECDSA P-256

The decoded request

Subject: C=BD, ST=Dhaka, L=Dhaka, O=Example Ltd, CN=www.example.com
Public key: elliptic curve prime256v1 (P-256), 256-bit
Signature algorithm: ecdsa-with-SHA256, self-signature valid
Subject alt names: DNS:example.com, DNS:*.example.com, DNS:www.example.com
358 bytes of DER; the private key is returned as PKCS#8 PEM.

Things to check before you rely on it

The private key is not encrypted. Add a passphrase with openssl pkcs8 -topk8 -in private.key -out private-enc.key before storing it anywhere shared.

Public CAs mostly ignore your subject fields apart from the names, and browsers need those names in the SAN list, so list every host name even when it equals the common name.

A request is bound to its key. If you lose the .key file, the certificate that comes back cannot be used; generate a new pair and start again.

Keys are generated by the browser's cryptography: RSA keys with public exponent 65537, and no support here for key sizes below 2048 bits, DSA, or Ed25519 requests.

  • Choose ECDSA P-256 unless a client you must support lacks it: the request is under half the size of an RSA 2048 one, and the key is generated almost instantly.
  • List the bare domain and the wildcard separately: *.example.com does not cover example.com itself.

Common errors and how to fix them

"Country must be exactly two letters, for example US or GB"
X.520 allows only an ISO 3166 two-letter code in the country field. Clear the field if you do not want to include a country.
"a wildcard is only valid as the whole left-most label"
Names such as www.*.example.com or *example.com are not valid in a certificate. Use *.example.com, or list each host name.

Best practices

  • Generate a new key for each request rather than reusing one: a fresh key limits what a leak can expose.
  • When the certificate arrives, check that it belongs to your key: the SHA-256 of openssl x509 -noout -pubkey -in cert.pem must equal the one from openssl req -in request.csr -noout -pubkey.
  • Confirm the request with the decode tab before submitting it: the names listed there are the names the certificate will cover. When the certificate comes back, the SSL certificate decoder on this site shows its names and chain.

Frequently asked questions

Is the private key sent anywhere?

No. The page makes no network request with it: the key pair is generated in your browser, shown to you, and discarded when you close the tab. Only the CSR is meant to leave your machine, when you give it to a certificate authority.

Why is my country code rejected?

The field accepts exactly two letters, such as US or GB. Longer names like United States are not valid in a certificate subject; leave the field empty if you are unsure.