How to generate a self-signed certificate using OpenSSL?
This blog post discusses the steps that you can follow in order to generate a self-signed certificate using openSSL. Use the following steps:
- Have the CN name ready for the certificate. For example, a CN name could be test.example.org
- Run the following command to generate the private key and the certificate. Enter the common name when prompted.
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
- Review the certificate that was created.
openssl x509 -text -noout -in certificate.pem
- If you want to combine the certificate file and the key file to PKCS#12 format, use the following command.
openssl pkcs12 -inkey key.pem -in certificate.pem -export -out certificate.p12
- Validate your PKCS#12 file.
openssl pkcs12 -in certificate.p12 -noout -info
That’s all for this blog post. I hope you learned something new! ☺️