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:
option -clcerts extract only client certificate without ca certs
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
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home