0

i am having SSL .crt file and i want two file #1 key.pem and #2 cert.pem for node HTTPS.

any one have any idea that how i can generate these files?

thanks in advance.

tushark
  • 101
  • 1
  • 2
  • 5

2 Answers2

0

If you want to generate Self Signed certificates, following are the commands (these command will generate certificate files in ./config/sslcerts folder)

mkdir -p ./config/sslcerts
openssl genrsa -out ./config/sslcerts/key.pem 4096
openssl req -new -key ./config/sslcerts/key.pem -out ./config/sslcerts/csr.pem
openssl x509 -req -days 365 -in ./config/sslcerts/csr.pem -signkey ./config/sslcerts/key.pem -out ./config/sslcerts/cert.pem
rm ./config/sslcerts/csr.pem
chmod 600 ./config/sslcerts/key.pem ./config/sslcerts/cert.pem
  • Thanks for quick reply. But i am having the server SSL certificate .crt file and from that file i want to convert them in key.pem and cert.pem for nodejs HTTPS – tushark Apr 12 '17 at 10:56
  • key.pem basically RSA PRIVATE KEY – tushark Apr 12 '17 at 11:08
  • read here http://stackoverflow.com/questions/991758/how-to-get-pem-file-from-key-and-crt-files –  Apr 12 '17 at 13:45
0

The key.pem is your private key. You can't get a private key from certificate because a certificate doesn't contain a private key.

You would have generated a public-private key pair. The crt file you have is your signed public key. You will have a different private key corresponding to your public key.

user3493833
  • 271
  • 2
  • 5