Thursday, December 11, 2014

How to generate DSA & RSA SSH Key in Linux and Windows

How to generate DSA & RSA SSH Key
********************************************
 
Procedure to Generate DSA (Digital Signature Algorithm) or RSA Key Pair in Windows
=====================================================================
PuTTY is an SSH client for Windows that will use to generate your SSH keys. PuTTY is a free open-source terminal emulator that functions much like the Terminal application in Windows environment.
 
When you install the PuTTY client, you also install the PuTTYgen utility. PuTTYgen is what you will use to generate your SSH key for a Windows
 
To generate an SSH key with PuTTYgen, follow these steps:
 
Open the PuTTYgen program from “C:\Program Files\PuTTY”
For Type of key to generate, select SSH-2 RSA.
Click the Generate button.
Move your mouse in the area below the progress bar. When the progress bar is full, PuTTYgen generates your key pair.
Type a passphrase in the Key passphrase field. Type the same passphrase in the Confirm passphrase field. You can use a key without a passphrase, but this is not recommended (but here please generate key without passphrase)
Click the Save public & private key button to save the public & private key.
 
Right-click in the text field labeled Public key for pasting into OpenSSH authorized_keys file and choose Select All.
Right-click again in the same text field and choose Copy.
 
Procedure to Generate DSA (Digital Signature Algorithm) or RSA Key Pair in Unix/Linux
=====================================================================
Use ssh-keygen command as follows:
 
$ ssh-keygen -t dsa
 
Output:
Enter file in which to save the key (/home/<username>/.ssh/id_dsa):  Press [Enter] key
Enter passphrase (empty for no passphrase): myPassword
Enter same passphrase again: myPassword
Your identification has been saved in /home/<username>/.ssh/id_dsa.
Your public key has been saved in /home/<username>/.ssh/id_dsa.pub.
The key fingerprint is:
04:be:15:ca:1d:0b:1e:e2:a7:e5:de:96:4a:b1:a6:01 <username>@<domainname>.com
 
Steps:
a) Please enter a passphrase and confirm the same.
b) The public key is written to /home/<username>/.ssh/id_dsa.pub
c) The private key is written to /home/<username>/.ssh/id_dsa
 
Note:
====
DSA is more secure than RSA & faster in signing "signature generation" but slower in verifying (slower for validation, slower when encrypting) i.e. authenticates slower (recommended)
 
RSA is less secure than DSA & slower in signing "signature generation" but faster in verifying (faster for validation, faster when encrypting) i.e. authenticates faster
 
Public key is made available to everyone via a publicly accessible repository or directory

Private Key must remain confidential to its respective owner. (It is important that not to share your private key for Security concern)

No comments:

Post a Comment

TCP/UDP Protocols/Prots & important port numbers in Linux OS

TCP/UDP Protocols/Ports are ranging from 0-65535 so total we have 65536 ports & because of the limitation in TCP/IP stack where the por...