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:

  1. Have the CN name ready for the certificate. For example, a CN name could be test.example.org
  2. 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
  3. Review the certificate that was created.
    openssl x509 -text -noout -in certificate.pem
  4. 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
  5. 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! ☺️

Previous
Previous

What is a symlink?

Next
Next

How to run a Docker container using privileged access?