1

I got .key and .crt file form DigiCert.

Content of my xyz_com.key file is PRIVATE KEY.

head xyz_com.key -n2
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDqFD0YmmeKyVbg

Before that I am using self signed certificate, generated with below command.

openssl req -new -newkey rsa:2048 -x509 -keyout ca_cert.key -out ca_cert -days 3650 -passin "pass:abcde" -passout "pass:abcde" -subj '/C=xy/ST=xyz/L=xyz/O=xyz/CN=xyz.com/emailAddress=f@g.h' -passout "pass:abcde"

Content of my ca_cert.key file is PRIVATE KEY.

head ca_cert.key but  -n2
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQITNXPGHEofWsCAggA

So self signed key file's content is ENCRYPTED PRIVATE KEY and DigiCerts keys file's content is PRIVATE KEY. My application working fine when using ca_cert.key,but not with xyz_com.key

Is there any way to convert PRIVATE KEY to ENCRYPTED PRIVATE KEY ?

Manthan Tilva
  • 3,135
  • 2
  • 17
  • 41

1 Answers1

3

Yes. The following command should do it:

$ openssl pkcs8 -in mykey.pem -out myencryptedkey.pem -topk8
Matt Caswell
  • 8,167
  • 25
  • 28