Create self signed certificate using OpenSSL

You can create your own, self signed certificate for testing purposes using OpenSSL and two simple commands

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days XXX

…where XXX stands for number of days the certificate is to be valid (i.e. XXX = 365)
Here you’ll be asked for Country, Location, Organization, Name and Email. You’ll also have to provide a password for your private key.

openssl pkcs12 -export -in cert.pem -inkey key.pem -out certificate.p12

This command creates .P12 file which you can use to digitally sign your emails, java code, etc.
You will be asked for a password to your private key – the same you entered for the first command.
Subsequently you’ll be asked for an Export password – this password will be used once you want to export the certificate.

Leave a Reply

Your email address will not be published. Required fields are marked *