How to create a self signed RSA certificate with OpenSSL


Reference of commands to create a self signed RSA certificate with OpenSSL

To create a certificate with private key:

1
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem

Print out the certificate meta data:

1
openssl x509 -text -noout -in certificate.pem

Generate a P12 with the certificate and key:

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

Validate the P12:

1
openssl pkcs12 -in certificate.p12 -noout -info

References