Creating a Self-Signed SSL Certificate

Prerequisites

The openssl library is required to generate your own certificate.

Generate private key and certificate signing request

A private key and certificate signing request are required to create an SSL certificate. These can be generated with a few simple commands.

$ openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
$ openssl rsa -passin pass:x -in server.pass.key -out server.key
$ rm server.pass.key
$ openssl req -new -key server.key -out server.csr

Generate SSL certificate

The self-signed SSL certificate is generated from the server.key private key and server.csr files.

$ openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt 

Leave a Reply

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