How To Generate Self-Signed TLS Certificate in Linux

How To Generate Self-Signed TLS Certificate

TLS (Transport Layer Security)is cryptographic protocol for providing secure communications.

To Generate Self-Signed TLS Certificate login as root user.
Create certs directory.

# mkdir /root/certs
# cd /root/certs

Generate certificate with openssl command line tool:

# openssl req -new -newkey rsa:4096 -x509 -sha512 -days 3650 -nodes -out Certificate.crt -keyout PrivateKey.key

You will be prompted to add identifying information (Country, city, name, …). Its not necessary step, so you can jut press enter and skip answers.

-newkey rsa:4096: Create a 4096 bit RSA key
-days 3650: Time in days the certificate is being issued (can be changed)
-out Certificate.crt: Output certificate file name
-keyout PrivateKey.key: Output Private key file name (can be changed)

Here is example output:

Generate Self-Signed TLS Certificate

arstech

Leave a Reply

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