Unix Blog

Thursday, April 22, 2010

OpenSSL commands

Convert .p12 to .pem using Openssl
openssl pkcs12 -in filename.p12 -out filename.pem

Convert .key to .pem
openssl rsa -in server.key -text > my-key.pem

Convert .crt to .pem
openssl x509 -inform PEM -in server.crt > my-cert.pem

Create .p12 from .crt and .key
1) openssl rsa -in server.key -text > my-key.pem
2) openssl x509 -inform PEM -in server.crt > my-cert.pem
3) openssl pkcs12 -inkey my-key.pem -in my-cert.pem -export -name mycertname -out myp12file.p12
Enter Export Password:
Verifying - Enter Export Password:


Export private key from password protected .p12 file 
openssl pkcs12 -in filename.p12 -password stdin -out key.pem -nocerts

Export cert from password protected .p12 file 
openssl pkcs12 -in filename.p12 -password stdin -out key.pem -nokeys -clcerts

option -clcerts extract only client certificate without ca certs

Create request (CSR) for submission to Certificate Authority

openssl req -out /opt/apacheconf/ssl/mywebsite.csr -new -newkey rsa:2048 -nodes -keyout /opt/apacheconf/ssl/mywebsite-privkey.key

View CSR file content
openssl req -in myfile.csr -noout -text

Error

C:\OpenSSL-Win64\bin>openssl
WARNING: can't open config file: /usr/local/ssl/openssl.cnf

Solution
set OPENSSL_CONF=C:\OpenSSL-Win64\bin\openssl.cfg
Set openssl conf path in command line and rerun openssl


posted by Jayanthi Krishnamurthy @ 9:33 AM   0 Comments

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Newer›  ‹Older

About Me

Name: Jayanthi Krishnamurthy

View my complete profile

Posts

  • OpenSSL commands

Older Posts Newer Posts

Archives

Subscribe to
Posts [Atom]