• Home »
  • Insights »
  • Use OpenSSL to Verify the Contents of a CSR Before Submitting For a SSL Certificate

Use OpenSSL to Verify the Contents of a CSR Before Submitting For a SSL Certificate

When purchasing SSL certificates for your website online you will be required to generate a SSL CSR, or Certificate Signing Request, to obtain a SSL CRT, or Certificate. In the process of generating your CSR you will be required to provide numerous pieces of information including Country, State, City, Company, Department, server common name, contact email address, and a challenge password. The most important field being the server common name as this is the domain that will securely serve web pages over HTTPS to make sure data is encrypted in each direction and because of this is secure.

On numerous occasions I have accidentally fat fingered the domain or not included www. when it was required, etc. It is possible to resolve some of these issues by reissuing the certificate however it can really be a pain so it is a much better policy to double and triple check the contents of the CSR before submitting to the SSL certificate provider. Use the information below to generate the CSR using openssl on a server running Apache with modssl and then use openssl to spit back the contents of the CSR you generated to verify the contents are correct.

Generate Key With OpenSSL:

openssl genrsa -out test.key 1024

Output From Generating a SSL Key with OpenSSL:

Generating RSA private key, 1024 bit long modulus
.++++++
........................++++++
e is 65537 (0x10001)

Generate CSR Using OpenSSL Via The Above SSL Key:

openssl req -new -key test.key -out test.com.csr

Questions Answered While Generating a CSR With OpenSSL:

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:Kentucky
Locality Name (eg, city) [Newbury]:Louisville
Organization Name (eg, company) [My Company Ltd]:QuestionDefense
Organizational Unit Name (eg, section) []:IS
Common Name (eg, your name or your server's hostname) []:www.test.com
Email Address []:test@example.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

The contents of the test.com.csr file is what will be submitted to obtain a SSL Certificate (.crt) file which will provide secure communications between your web site and customers computers. Before submitting the file and going through the confirmation process for the CRT file use the command below to verify the contents of the CSR file.

Command to Verify Certificate Signing Request (.CSR) Contents:

openssl req -noout -text -in test.com.csr

Output of The Above Command Verifying the CSR Contents:

Certificate Request:
Data:
Version: 0 (0x0)
Subject: C=US, ST=Kentucky, L=Louisville, O=QuestionDefense, OU=IS, CN=www.test.com/emailAddress=test@example.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
00:bc:04:de:e4:80:dc:58:3b:d0:01:be:3b:11:47:
8c:6f:7d:33:3d:13:33:ba:11:25:13:b1:78:11:17:
d2:8f:2d:fe:d7:8e:e5:56:6e:79:fc:90:9e:e9:38:
0e:44:df:a6:6d:5c:35:89:fc:04:64:21:21:43:c8:
3d:47:18:20:6f:e5:ad:46:f8:28:56:98:1f:e2:36:
82:2d:b2:30:3f:42:37:90:61:11:f5:7b:14:7b:52:
ae:c7:0c:fe:d5:46:f5:38:82:67:b2:f2:37:45:25:
34:a5:6a:ee:e5:16:d4:f8:ce:2a:e1:22:a7:ec:29:
0b:92:b0:77:25:c0:57:c1:0d
Exponent: 65537 (0x10001)
Attributes:
a0:00
Signature Algorithm: sha1WithRSAEncryption
35:5b:8c:9e:21:73:c8:b6:50:f7:d2:1f:a4:ce:b7:21:3f:d6:
76:53:d3:df:ed:73:59:a9:23:cc:e0:16:cb:38:95:8c:aa:f0:
d6:3b:73:f8:5f:e7:1c:8e:ee:57:6e:0a:b8:db:7e:64:29:71:
cc:88:4b:ed:c4:87:b5:a6:cb:0f:01:de:74:bd:8e:84:b5:00:
5f:aa:be:6b:a5:57:e8:56:9d:fb:a6:57:6a:ce:e1:81:c5:6b:
bb:c5:90:78:86:35:d5:8d:70:e3:78:17:07:ff:44:09:6e:90:
da:d4:88:f0:08:04:cf:d7:46:a0:3a:ee:e5:6a:d7:c4:7c:cf:
45:79

Notice the fourth line includes the data you need verify before submitting for a SSL certificate. The most important bit of information is the CN or common name which in the example above is www.test.com. Spending the little bit of time to verify this information can save you a lot of trouble trying to resolve any problems later.


List Price: $39.99 USD
New From: $15.95 USD In Stock
Used from: $0.78 USD In Stock

>>> RapidSSL Certificates From Narfonix:
>>>$24.95/yr. or $43.90/2 yrs.

Share