To understand the concept of SSH keygen, we should understand Secure Shell in the first place.
I will introduce SSH, its usage, capabilities, and many more in this blog.
Then we can learn about the keys, and their advantages, and understand how do they work.
SSH is a network protocol that allows users to access another machine remotely and have partial administration privileges. In other words, it is a way of connecting to a secure computer over an unsecured network.
Some huge advantages of using this system are strong passwords and key authentications. Data encryption between two computers is also available.
Using SSH, hosting servers are able to make a list of authorized public keys to give an easy and immediate access to their users. Later in this blog I will discuss the SSH Keys.
SSH Capabilities
Automated user remote access within a safe environment
Secure File Transfer
Remote Device & Project Management
SSH can be a perfect platform for in progress projects. It is ideal for applying patches due to the secure connection and file transfer. Admins can give different user access levels and modify the server at any time.
SSH Keygen
As we discussed earlier, users can connect to a SSH host using passwords or their pre authorized public keys.
We are fairly familiar with the password login, but what is the authorized public key? How does it work?
Individuals can create SSH keys using Keygen. This form of authorization has been created to improve the security of systems by avoiding storing the passwords of many users.
SSH keys consist of 2 parts:
Public Keys
Private Keys
In a similar concept to the above picture, each lock has a unique key and each key will open a specific lock. Private and public keys have a similar concept.
Users can share their public keys to different users or servers, and other users can encrypt various files using those public keys. The only way to decrypt the file or message would be by using the private key which should not be shared under no circumstances.
Using this concept users can safely share encrypted files and data, and even if the system get hacked, hackers won't be able to decrypt the messages since they don't have access to the private keys.
Double Encryption + Example
We can go one level higher and double encrypt a file. Lets say I want to share a file with my co-worker Johnny. First we trade our public keys with each other.
I will encrypt the file using my private key, then I will encrypt it again using Johnny's public key and send the file to him through a network.
Johhny is able to decrypt the first encryption using his private key, since I used his public key. Then he can decrypt it again using my private key, since I used my private key.
This is one of the safest ways to communicate and share important files.
Creating an SSH Key
There are various types of SSH keys such as OpenSSH which we discussed, Tectia SSH, and keys for PuTTY.
You can learn more about them by clicking on the provided links.
The process of creating an SSH Key using Keygen is pretty straight forward, but before doing that it is probably a good idea to check out the different algorithms and key sizes.
There are currently 4 different algorithms to create an SSH Key which includes:
rsa
dsa
ecdsa
ed25519
You can learn more about the creating process, algorithms and key sizes on the SSH official website: What is ssh-keygen & How to Use It to Generate a New SSH Key?
References
Loshin, P. (2021, September). Secure Shell (SSH). Techtarget. What is SSH (Secure Shell) and How Does it Work? Definition from TechTarget
Preveil. (2019, January 12). Public – private key pairs & how they work. Public and private encryption keys | PreVeil
SSH Academy. (n.d.). How to Use ssh-keygen to Generate a New SSH Key? What is ssh-keygen & How to Use It to Generate a New SSH Key?
Comments