So I ran into a problem that I’ve been working on for a few days now, and figured I’d give it a quick writeup so that others who may be experiencing this problem would be able to get further and quicker than I did!

So the situation is, how do you configure Apache2.2 with OpenSSL so that you can generate CSR information and host an SSL certificate? Now the catch is that this is all on Windows.

The first thing that you want to do is to download Apache2.2 with SSL. The URL for this is located off the Apache Foundation’s mainsite:

http://apache.oregonstate.edu/httpd/binaries/win32/apache_2.2.8-win32-x86-openssl-0.9.8g.msi

Once you download the MSI file, go ahead and install it. The installer is fairly straight forward, the only things that you will need to do is to fill out certain fields. There is a great writeup on Apache’s website on what each of those variables are and what you need to do through the MSI installer. That’s located:

http://httpd.apache.org/docs/2.2/platform/windows.html

So assuming that you go through that bit and you’ve tested and confirmed that Apache is working the way it should be, the next bit is to get through generating a key file and cert file. Just because they are the biggest and most expensive, I’ll use Verisign for the purposes of this writeup. The URL to their knowledge site that has information on this is:

https://knowledge.verisign.com/support/ssl-certificates-support/index?page=content&id=AR198

The first step that Verisign provides is:

Step 1: Generate a Key Pair
The utility “openssl” is used to generate the key and CSR. This utility comes with the OpenSSL package and is usually installed under /usr/local/ssl/bin. If you have installed them elsewhere you will need to adjust these instructions appropriately.
Type the following command at the prompt:
openssl genrsa –des3 –out www.mydomain.com.key 1024
This command generates a 1024 bit RSA private key and stores it in the file www.mydomain.com.key.
When prompted for a pass phrase: enter a secure password and remember it, as this pass phrase is what protects the private key. Both the private key and the certificate are required to enable SSL.
NOTE: To bypass the pass phrase requirement, omit the -des3 option when generating the private key. If you leave the private key unprotected, VeriSign recommends access to the server be restricted so that only authorized server administrators can access or read the private key file.

For the purposes of my test, I ran this command from:

C:\Program Files\Apache Software Foundation\Apache2.2\bin

So now, the next step is:

Step 2: Generate the CSR
Type the following command at the prompt:
openssl req –new –key www.mydomain.com.key –out www.mydomain.com.csr (click here for image)
This command will prompt for the following X.509 attributes of the certificate:
Country Name: Use the two-letter code without punctuation for country, for example: US or CA.
State or Province: Spell out the state completely; do not abbreviate the state or province name, for example: California
Locality or City: The Locality field is the city or town name, for example: Berkeley. Do not abbreviate. For example: Saint Louis, not St. Louis
Company: If your company or department has an &, @, or any other symbol using the shift key in its name, you must spell out the symbol or omit it to enroll. Example: XY & Z Corporation would be XYZ Corporation or XY and Z Corportation.
Organizational Unit: This field is optional; but can be used to help identify certificates registered to an organization. The Organizational Unit (OU) field is the name of the department or organization unit making the request. To skip the OU field, press Enter on your keyboard.
Common Name: The Common Name is the Host + Domain Name. It looks like “www.company.com” or “company.com”.
VeriSign certificates can only be used on Web servers using the Common Name specified during enrollment. For example, a certificate for the domain “domain.com” will receive a warning if accessing a site named “www.domain.com” or “secure.domain.com”, because “www.domain.com” and “secure.domain.com” are different from “domain.com”.
Please do not enter your email address, challenge password or an optional company name when generating the CSR.
A public/private key pair has now been created. The private key (www.domain.com.key) is stored locally on the server machine and is used for decryption. The public portion, in the form of a Certificate Signing Request (certrequest.csr), will be for certificate enrollment.
Click here for an image of the CSR.
To copy and paste the information into the enrollment form, open the file in a text editor such as Notepad or Vi and save it as a .txt file. Do not use Microsoft Word as it may insert extra hidden characters that will alter the contents of the CSR.
Once the CSR has been created, proceed to Enrollment.

Now here comes the tricky bit. This part stumped me for quite awhile. If you run the above and get an error message like:

Unable to load config info from /usr/local/ssl/openssl.cnf

Now since this is a Windows machine, obviously the path that is being reported is not going to work as this is going to the /usr mountpoint on a *nix machine. So to fix this you will need to run the command as:

openssl req -new -config “C:\Program Files\Apache Foundation Software\Apache2.2\conf\openssl.cnf” -key keyfilename.key -out csrfilename.csr

You can change the physical path above to match the location of your openssl.cnf file. Doing the above I got past the error message that I’ve listed above and was able to move on to the next steps in the CSR process.