Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Certificate keys - conversion

Tags:

openssl

For purpose of testing I need to enable SSL on IIS8 (On Amazon servers). I created a test key using IIS and I exported that key in *.pfx format. Now in Load Balancer setting I need to have that key converted to *.PEM format. I did just that using https://www.sslshopper.com/ssl-converter.html

When I open newly generated *.PEM key I have two fields: -----BEGIN PRIVATE KEY----- key is here... -----END PRIVATE KEY-----

and also I have

-----BEGIN CERTIFICATE----- certificate is in here... -----END CERTIFICATE-----

Now when I enter those values in LoadBalancer, it always complains with:

Invalid Public Key Certificate.

I have tried pasting both values with ---BEGIN and without to same result...

What is going on?

like image 395
Wexoni Avatar asked Jan 10 '13 17:01

Wexoni


2 Answers

For everybody already had .pem format and still getting "Invalid Public Key Certificate", here is my solution.

The certificate chain bundle is actually formed by 2 certificates, one after the other: inverting the order of the two worked for me.

like image 194
Bruno Belotti Avatar answered Oct 12 '22 14:10

Bruno Belotti


This link provided me with the solution:

https://forums.aws.amazon.com/thread.jspa?threadID=56937

The tech support from Amazon detailed what commands need to be used. Basically use first which is: --This will get you a key openssl pkcs12 -in filename.pfx -out private.key.1 -nodes -nocerts

and use this one as will to get a certificate itself: openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem

like image 21
Wexoni Avatar answered Oct 12 '22 14:10

Wexoni