We have purchased a SHA-2 certificate from RapidSSL, but I can't for the life of me get it working! We first created out .key and .crt files on the destination server, using (obviously blanked out the important stuff);
openssl req -new -newkey rsa:2048 -nodes -out www_x.com.csr -keyout www_x_com.key -subj "/C=GB/ST=x/L=x/O=x/CN=www.x.com"
This created the .crt and .key files fine. Now, I saved the certificate they sent me as main.crt. Then, in the email they send me to:
https://knowledge.rapidssl.com/support/ssl-certificate-support/index?page=content&id=AR1549
On here, they have 2 SHA-2 intermediate certificates ... I'm assuming it the 2nd one I would need? (not even sure what the first one is!)
Then, after saving that I cat the files:
cat www_x.com.csr CA_Cert.crt > new.crt
(also tried it the other way around: cat CA_Cert.crt www_x.com.csr > new.crt , but neither work)
Then, in my nginx config I have:
ssl on; ssl_certificate /home/test/certs/new.crt; ssl_certificate_key /home/test/certs/www_x_com.key; ..then when I reboot, I get a failed error:
nginx[30762]: nginx: [emerg] SSL_CTX_use_PrivateKey_file("/home/test/certs/www_x_com.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)
Can anyone help? I'm used to being provided with a ZIP file that has everything I need in it... but not so with these guys!
UPDATE: All working! Thanks everyone for your help. It turns out to be a double whammy:
1) The person I was doing this for (who purchased the SSL certificate), didn't think to enter the CSR code when generating the certificate =) 2) cat was putting the certificates with no break - so it was reading it all as one line
Other than that, it all seems to be working now. Glad that ones out of the way, it was driving me up the wall!!!
-----BEGIN CERTIFICATE----- and end like this: -----END CERTIFICATE-----Between the certs there should be no line spaces