How To: Create Self-Signed Certificate – OpenSSL

What is a self-signed SSL certificate? A self-signed certificate is a certificate that is not signed by a trusted authority.

Nevertheless, the self-signed certificate provides the same level of encryption as a $100500 certificate signed by a trusted authority.

In this article i will show how to create a self-signed certificate that can be used for non-production or internal applications.

Cool Tip: Check the expiration date of the SSL Certificate from the Linux command line! The fastest way! Read more →

Create Self-Signed Certificate

Generate self-signed certificate using openssl:

$ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 -subj '/CN=localhost'

Options that you might want to change while creating a self-signed certificate:

-newkey rsa:4096 Generate a 4096 bit RSA key.
-keyout key.pem Save a key to the key.pem file.
-out cert.pem Save a certificate to the cert.pem file.
-nodes Do not protect the private key with a passphrase.
-days 365 The number of days to make a certificate valid for.
-subj '/CN=localhost' Use this option to suppress questions about the contents of the certificate. Replace localhost with your desired domain name.
0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Get UUID of Hard Disks [Update]
Viewed 646 times since Tue, Jul 17, 2018
Linux get the list of FC HBA’s and WWPN
Viewed 1166 times since Tue, May 22, 2018
linux manual tools
Viewed 674 times since Fri, Sep 28, 2018
Applescript: Run or Call a Shell Script
Viewed 2130 times since Tue, Aug 6, 2019
Monitoring bezpieczeństwa Linux: integracja auditd + OSSEC cz. I
Viewed 861 times since Fri, Apr 5, 2019
6 rsync Examples to Exclude Multiple Files and Directories using exclude-from
Viewed 626 times since Wed, Oct 31, 2018
Linux - How to get network speed and statistic of ethernet adapter in Linux
Viewed 644 times since Fri, Jun 8, 2018
Check a Website Availability from the Linux Command Line
Viewed 535 times since Mon, Feb 18, 2019
Sample logrotate configuration and troubleshooting part 2
Viewed 608 times since Fri, Nov 30, 2018
Using Kerberos security with Server for NFS
Viewed 1414 times since Wed, Jun 27, 2018