Languages
[Edit]
EN

Bash - convert *.pem files to *.p12 file (cert.pem and key.pem to keystore.p12)

3 points
Created by:
Creg
9150

In this short article we would like to show how to convert public certificate with private key saved as *.pem files into *.p12 keystore using command line.

Run following command:

openssl pkcs12 -export -in public_certificate.pem -inkey private_key.pem -out keystore.p12

or with certificate / key alias:

openssl pkcs12 -export -in public_certificate.pem -inkey private_key.pem -out keystore.p12 -name my-alias

 

Notes:

  • we will be asked to type new password for created keystore.p12 file,
  • it is recommended to use Command Line under Windows (cmd.exe).

Example output:

Enter Export Password:
Verifying - Enter Export Password:

Where:

  • Enter Export Password: and Verifying - Enter Export Password: will be used to secure keystore.p12 file - they will be necessary later to read p12 file back.

 

Final result:

*.pem to *.p12 conversion (cert.pem and key.pem to keystore.p12)
*.pem to *.p12 conversion (cert.pem and key.pem to keystore.p12)

References

  1. Privacy-Enhanced Mail - Wiki
  2. PKCS #12 / *.p12 file format - Wiki

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Bash

Bash - convert *.pem files to *.p12 file (cert.pem and key.pem to keystore.p12)
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join