SSL

Hashing

Hashing is a technique used in computing to ditermine if a file has changed from an expected state.

SSL-Hashing.jpg

Figure 1: This is a diagram of how hashing is used

Asymmetric Keys

Asymmetric keys are a set of keys used to safely send data without it being readable by unwanted parties.

SSL-Asymmetric.jpg

Figure 2: This is a diagram of how asymmetric keys are used

OpenSSL commands

This guide will describe how to generate various ssl certs. We will be using the openssl command, it is used to generate ssl certs of many kinds.

Generate an RSA private key with aes256 encryption

Here is an example of how to generate an RSA private key:

openssl genrsa -aes256 -out private.pem

Here we use the genrsa option to make sure we are generating an ssl key of RSA type. We also passsed the -aes256 flag to specify we wanted it to have aes256 encryption on the key. Finally we specified the -out flag to give openssl the destination of where we want the private key.

It is worth noting that the -out flag is not necessary and the keys text will just be output to the terminal if the flag is not provided. If we wanted to specify an rsa key of a certain bit length we can just run the following:

openssl genrsa 4096

In this case we would generate an RSA key of 4096 bit length and the key will be output to the terminal.

Generate an RSA public key from a private key

Here is an example of how to generate an RSA public key using the private key we made:

openssl rsa -in private.pem -outform PEM -pubout -out public.pem

Here we are using the rsa option to specify we are working with an rsa file. We then provide the -in flag and give a path to our private key. We are going to use the -outform flag to specify that we want the output of openssl to be of PEM format. We use the -pubout flag to specify we want to output a public key from this command. Finally we give the -out flag and list a destination for our public key.

This page was last updated: 2024-11-06 Wed 18:09. Source