I have a .pem file which contains both my certificate and encrypted private key, ie:
Bag Attributes....-----BEGIN CERTIFICATE-----....-----END CERTIFICATE-----Bag Attributes....-----BEGIN ENCRYPTED PRIVATE KEY-----....-----END ENCRYPTED PRIVATE KEY-----
And I need to instead have a .pem file containing both the certificate and the decrypted private key. How can I achieve this on linux, preferrably utilising the openssl application?
asked Mar 21, 2018 at 13:32
MaddenMadden
14111 gold badge11 silver badge44 bronze badges
Add a comment |
To decrypt a private key from a pem file you would do something like this with a subcommand (rsa, pkey, pkcs8, pkcs12):
openssl rsa -in inputfilename -out outputfilename
Your input file is different because you concatenated both keys in one file. But you can simple edit the pem file to split it in 2 files.
answered Mar 21, 2018 at 17:53
bbaassssiieebbaassssiiee
1,36511 gold badge1111 silver badges1717 bronze badges
5
-
I think you need a subcommand in there. Maybe
pkey
? Please @ me when you fix it and I'll remove my downvote.Mar 21, 2018 at 19:51
-
Yes, it should be
pkey
for new format keys (PKCS8) orrsa
for the older PKCS1.Mar 21, 2018 at 21:59
-
-
2
To do it without editing:
openssl x509 <in >out; openssl pkey <in >>out
Mar 24, 2018 at 10:04
-
Hi All, is there any updated answer for this? I have the same issue. These commands did not work for me
Oct 26, 2022 at 5:04
Add a comment |
Not the answer you're looking for? Browse other questions tagged
Not the answer you're looking for? Browse other questions tagged