Create p12 from a .pem with only a private key

Michael Wojcik Michael.Wojcik at microfocus.com
Thu Feb 20 14:48:41 UTC 2020


> From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf Of
> Estefania
> Sent: Thursday, February 20, 2020 01:36
>
> I do not know if I explained well, i have a .pem with a private key inside
> like this.
>
> -----BEGIN PRIVATE KEY-----
> masdfasdfasdfasdfasdfasdfasdff
> asdfasdfasdfasdfasdfasdfasdfasf
> asdfasfasdfasdfasdfasdfasdfasdf
> -----END PRIVATE KEY-----
>
>
> and i need to convert it to .p12

This works fine for me:

$ openssl pkcs12 -export -inkey keyfile.pem -out keyfile.p12 -passin pass:keyfile-password -password pass:export-password -nocerts

You can verify the output with:

$ openssl pkcs12 -noout -info -in keyfile.p12

which (after entering the export password) should show the file contains the MAC and a PKCS#7 shrouded keybag.

--
Michael Wojcik
Distinguished Engineer, Micro Focus




More information about the openssl-users mailing list