Xerobit

CSR Generator: OpenSSL Command and SAN Configuration

Enter your domain name, organization details and key parameters to generate the exact OpenSSL command and configuration file needed for a certificate signing request. This csr generator runs entirely in your browser so no data is uploaded anywhere. Copy the output directly into your terminal to create your private key and CSR.

Additional domains or IPs. Prefix IPs with IP: (e.g., IP:192.168.1.1). Plain text defaults to DNS:.

Only used when RSA is selected.

Only used when EC is selected.

Command and Configuration

# Save this configuration as example.com.cnf

[req]
default_bits = 2048
prompt = no
utf8 = yes
distinguished_name = dn
req_extensions = req_ext

[dn]
CN = example.com

[req_ext]
subjectAltName = @san

[san]
DNS.1 = www.example.com
DNS.2 = example.com

# Run this command in a terminal:

openssl req -new -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr -config example.com.cnf

By · Published · How we build and test tools

How to use the csr generator (openssl command)

  1. Fill in the Common Name with your primary domain, such as example.com or *.example.com for a wildcard.
  2. Add any extra domains or IP addresses in the Subject Alternative Names box, one per line. Use the IP: prefix for IP addresses.
  3. Optionally enter your organization details like company name, city and two-letter country code.
  4. Choose between RSA or Elliptic Curve and select your preferred key size or curve.
  5. Click Generate and copy both the OpenSSL command and the configuration file contents to your terminal.

What this csr generator produces

This csr generator outputs two things you need to create a certificate signing request using OpenSSL. The first is the openssl req command that generates a new private key and the CSR simultaneously. The second is a configuration file containing your distinguished name fields and the subjectAltName extension block.

For EC keys the command passes the curve with -newkey ec -pkeyopt ec_paramgen_curve:prime256v1, which needs no special shell syntax. For RSA keys it passes the bit length directly via -newkey rsa:2048. The -nodes flag ensures the private key is not encrypted with a passphrase, which most web servers require for unattended restarts.

Understanding the OpenSSL req command

The core command follows this structure:

openssl req -new -newkey TYPE -nodes -keyout domain.key -out domain.csr -config domain.cnf

For an RSA 2048-bit key, TYPE becomes rsa:2048. For an EC key using the P-256 curve, it becomes ec -pkeyopt ec_paramgen_curve:prime256v1. The -new flag tells OpenSSL to create a new request rather than parsing an existing one. The -config flag points to the generated configuration file so OpenSSL knows what subject fields and extensions to include without prompting you interactively.

Why Subject Alternative Names matter

Modern browsers ignore the Common Name field for hostname validation and rely exclusively on the SAN extension. If your certificate lacks a SAN entry for a domain, visitors will see a security warning even if that domain matches the Common Name exactly.

In the configuration file, SANs are defined under a dedicated section referenced by req_extensions. Each entry needs a type prefix. Use DNS: for hostnames and IP: for IPv4 or IPv6 addresses. The csr generator automatically applies the DNS: prefix to entries that lack one, but being explicit prevents mistakes.

RSA versus Elliptic Curve keys

RSA keys at 2048 bits remain the default for broad compatibility. They produce larger signatures and slower handshakes compared to EC keys, but every certificate authority and server software supports them. A 4096-bit RSA key offers more security margin at the cost of noticeably higher CPU usage during TLS handshakes.

Elliptic Curve keys provide equivalent security with much smaller key sizes. The prime256v1 curve (also called P-256) offers roughly the same strength as a 3072-bit RSA key while being faster to compute. The secp384r1 curve (P-384) is stronger still. Choose EC if your server software and CA support it, which most modern systems do.

Configuration file structure

The generated .cnf file has three sections. The [req] section sets the key size, disables prompts with prompt = no, defines the distinguished name section and points to the extensions section. The [dn] section holds your subject fields like CN, O, OU, L, ST and C. Empty fields are omitted entirely because some CAs reject requests with empty attributes.

The [req_ext] section contains the subjectAltName directive pointing to a final [san] section where each alternative name is listed as DNS.1, DNS.2, IP.1 and so on. After generating your CSR, you can verify its contents using a csr decoder to confirm all fields and SANs are correct before submitting it to your certificate authority.

Common mistakes to avoid

Leaving the SAN list empty or forgetting to include the Common Name in the SAN list are frequent errors. Always add your primary domain to the SANs even though it appears in the Common Name field. Another common issue is using an invalid country code. The C field must be exactly two uppercase letters matching the ISO 3166-1 alpha-2 standard.

The command is a single line with no shell-specific syntax, so it runs in bash, zsh, PowerShell or cmd wherever OpenSSL 1.1.1 or newer is installed. If you leave the SAN box empty, the Common Name is used as the only SAN when it is a host name or an IP address. Finally, protect the generated .key file immediately. It contains your unencrypted private key and should have permissions set to 600.

Worked examples

ExampleInputResult
Basic RSA 2048Common Name (domain): example.com; Subject Alternative Names: www.example.com / example.com; Key Type: rsa; RSA Key Size: 2048; EC Curve: prime256v1# Save this configuration as example.com.cnf / [req] / default_bits = 2048 / prompt = no / utf8 = yes / distinguished_name = dn / req_extensions = req_ext / [dn] / CN = example.com / [req_ext] / subjectAltName = @san / [san] / DNS.1 = www.example.com / DNS.2 = example.com / # Run this command in a terminal: / openssl req -new -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr -config example.com.cnf
Organization with EC P-256Common Name (domain): shop.example.org; Subject Alternative Names: shop.example.org / api.example.org; Organization (O): Example Org; Organizational Unit (OU): Engineering; Locality / City (L): Austin; State / Province (ST): Texas; Country Code (C): US; Key Type: ec; RSA Key Size: 2048; EC Curve: prime256v1# Save this configuration as shop.example.org.cnf / [req] / default_bits = 2048 / prompt = no / utf8 = yes / distinguished_name = dn / req_extensions = req_ext / [dn] / C = US / ST = Texas / L = Austin / O = Example Org / OU = Engineering / CN = shop.example.org / [req_ext] / subjectAltName = @san / [san] / DNS.1 = shop.example.org / DNS.2 = api.example.org / # Run this command in a terminal: / openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -keyout shop.example.org.key -out shop.example.org.csr -config shop.example.org.cnf
Wildcard with IP SANCommon Name (domain): *.example.com; Subject Alternative Names: *.example.com / example.com / IP:10.0.0.1; Key Type: rsa; RSA Key Size: 4096; EC Curve: prime256v1# Save this configuration as wildcard.example.com.cnf / [req] / default_bits = 4096 / prompt = no / utf8 = yes / distinguished_name = dn / req_extensions = req_ext / [dn] / CN = *.example.com / [req_ext] / subjectAltName = @san / [san] / DNS.1 = *.example.com / DNS.2 = example.com / IP.1 = 10.0.0.1 / # Run this command in a terminal: / openssl req -new -newkey rsa:4096 -nodes -keyout wildcard.example.com.key -out wildcard.example.com.csr -config wildcard.example.com.cnf

FAQ

Does this csr generator create my private key?

No. It generates the OpenSSL command and configuration file you need. You run the command in your own terminal to create the private key and CSR locally. Nothing leaves your machine.

Should I include the Common Name in the SAN list?

Yes. Modern browsers only check the SAN extension for hostname validation. Always add your primary domain to the SAN list even if it matches the Common Name.

Which key type should I choose?

RSA 2048 is the safest choice for universal compatibility. Choose EC prime256v1 if your server and certificate authority support it, as it provides better performance with equivalent security.

How do I add an IP address as a SAN?

Prefix the IP address with IP: in the SAN textarea, for example IP:192.168.1.1. Entries without a prefix are treated as DNS names automatically.

Can I use this for wildcard certificates?

Yes. Enter your wildcard domain like *.example.com as the Common Name and also add it to the SAN list. Note that wildcard SANs only cover one level of subdomain.

What do I do with the generated output?

Save the configuration block as a .cnf file, then paste the OpenSSL command into your terminal. After running it, submit the resulting .csr file to your certificate authority and keep the .key file secure.

How can I verify my CSR after generating it?

You can inspect the CSR contents using the OpenSSL command line or a csr decoder to confirm all subject fields and SANs are present before sending it to your CA.