Create p12 from a .pem with only a private key
hkario at redhat.com
Tue Mar 17 11:01:56 UTC 2020
On Thursday, 20 February 2020 09:35:56 CET, Estefania wrote:
> I do not know if I explained well, i have a .pem with a private key inside
> like this.
> -----BEGIN PRIVATE KEY-----
> -----END PRIVATE KEY-----
> and i need to convert it to .p12
> do i need a certificate aswell?
technically, no, the standard allows for storing just the key in the
that being said, I can imagine many implementations tripping over such
if you have a private key in "localhost.key" you can convert it to a
file using the following command:
openssl pkcs12 -export -out file.p12 -inkey localhost.key -nocerts -keypbe
aes-128-cbc -passout pass:password
> I have tried what you suggest:
> $ openssl req -x509 -subj /CN=foo -keyout /dev/null -nodes | openssl pkcs12
> -out x.p12 -export -nokeys
> Generating a 2048 bit RSA private key
> writing new private key to 'nul'
> Subject does not start with '/'.
> problems making Certificate Request
> unable to load certificates
> Sent from: http://openssl.6102.n7.nabble.com/OpenSSL-User-f3.html
Senior Quality Engineer, QE BaseOS Security team
Red Hat Czech s.r.o., Purkyňova 115, 612 00 Brno, Czech Republic
More information about the openssl-users