top of page
Search

Asymmetric Encryption Keys

Article overview


  • What is asymmetric encryption?

  • Locate the public and private keys

  • Analyse the output


Introduction


Asymmetric encryption uses a key pair for encryption. The key pair consists of a private and public key. The private key is generated randomly. It is kept secret ...shhhhh!!


This private key is then used to generate the public key. Each algorithm generated this differently based on the mathematical properties. I will not dive into the mathematics now, coz i do not know (One day, i hope to dig into this) but if that what satisfies your soul, find the mathematical details explained by Aniket


The public key generated can be shared widely.


Wondering where to find your public key? worry not, I will show you.


My environment


  • RockyLinux 8 in UTM on MacOs M1


Command

#ssh keygen -t rsa

  • keygen - Used to instruct the creation of keys

  • -t : This option specifies the type of key to create. It tells ssh-keygen which algorithm to use for generating the key.

  • rsa: This specifies that you want to create an RSA key pair. RSA (Rivest-Shamir-Adleman) is one of the most widely used asymmetric encryption algorithms.



Lets run this in the terminal





Once the above command is run, the below takes place


  1. The public/private key is generated.

  2. Prompt to specify the location to save the generated key.

  3. Provide passphrase


    The default location is ~/.ssh/id_rsa for the private key and ~/.ssh/id_rsa.pub for the public key.


It is possible to see the contents of both file , however, its important to remember that the private key should be kept secret and secure. If someone accesses the private key, they can potentially authenticate as you on systems where the corresponding key has been added.


Command to view the files on linux


use either cat or nano to view the files. I have nano installed

#nano ~/.ssh/id_rsa
#nano ~/.ssh/id_rsa.pub

Analysing the output


The key fingerprint is SHA256:......


What is the key fingerprint?


This is not the public key. This is an identifier for the public key. It is unque and a condensed version of the jey hence making it easier to access.

It shows that the key was generated by SHA256 algorithm.


Fingerprints help to secure the connection by preventing man in the middle attacks by allowing the users to verify that the public key they receive belongs to the server the intent to connect to.


The key's randomart image is a visual representation of the SSH fingerprint. It is used to visually distinguish between different keys even if the fingerprint might be same.



 
 

murakaru.com

©2023 by murakaru.com. 

Disclaimer: any and all opinions and views expressed throughout the content of this website are Murakaru's own and shall not be deemed to reflect the views of any potential affiliates.

bottom of page