SSL Certificate
Securing your website or application has become increasingly crucial in today’s digital landscape where cyber crimes become ever more pervasive.
One common way to achieve security is through encryption. Symmetric and asymmetric encryption have been heavily studied in the field of Cryptograph and are widely used in the industry to help secure digital systems. SSL certificates, which build on top of asymmetric encryption, are often used to secure websites by ensuring data in transit between clients and web server are encrypted, thus private and secure.
Businesses,organizations, and developers usually get SSL certificates from public CA(Certificate Authority) who act as the Source of Trust for the internet. It might be necessary to create self-signed SSL certificates in some cases,such as testing, learning, development, or internal purposes.
This article serves as a simple guide on how to generate self-signed SSL certificates using OpenSSL.
Step-by-Step Guide
1: Install OpenSSL
There are tons of information available on the internet on how to install OpenSSL.
- For Ubuntu or Debian-based system:
|
|
- For CentOS, Fedora, or RHEL-based systems:
|
|
- For MacOS
|
|
2: Generate a Private Key
|
|
Run the command to generate a 2048-bit RSA private key (replace test.key with your file name):
|
|
3: Create a Certificate Signing Request
A Certificate Signing Request(CSR) includes all information about your application and organization. Then a CSR can be used to generate the SSL certificate.
|
|
|
|
4: Request the Self-signed SSL Certificate
|
|
Command options and usage can be found at: https://www.openssl.org/docs/man1.1.1/man1/x509.html
|
|
5: Configure HTTPs Web Server
A self-signed SSL certificate is generated and can be used by the web server.
A popular choice is Nginx. And here is the example configuration of nginx HTTPs:
|
|