10.12.2020

Generate Gpg Key Pair Linux

GPG basic file encryption doesn’t required public/private key. But to make a encrypted file more secure you can use RSA/DSA algorithms. These algorithms generates public and private keys to encrypt file.

  1. Gpg Generate Public Key
  2. Generate Public Private Key Pair Linux Openssl
  3. Generate Gpg Key In Linux
  4. Gpg Key Server
  5. Gpg Gen Key
  6. Generate Gpg Key Pair Linux Windows 10

This article will help you to do following three tasks for File Encryption using GPG Key Pair in Linux.

Gpg Generate Public Key

GnuPG uses the raw data input from /dev/random for key generation. It uses /dev/random because it wants to ensure very high quality entropy for the keys, and /dev/urandom is not a good source of entropy on some systems (or at least was not, I'm not sure if this is still true).

  1. You can generate an SSH key pair directly in cPanel, or you can generate the keys yourself and just upload the public one in cPanel to use with your hosting account. When generating SSH keys yourself under Linux, you can use the ssh-keygen command. To do so follow these steps: Open up the Terminal.
  2. Creating GPG Keys Using the Command Line Use the following shell command: $ gpg2 -gen-key This command generates a key pair that consists of a public and a private key.
  • Create key pair
  • Encrypt/Decrypt file locally for same user account.
  • Encrypt file for other user.
  • Decrypt other users file.

Step 1: Create GPG Key Pair

The very first step is to generate key pair. Use the following command to generate gpg key pair.

Output:

Step 2: Encrypt/Decrypt File Current User

Encrypt file for single user only. No one other can decrypt this file.

–recipient name should be same as used in key generation. Above command will automatically generate a encrypted file named tecadmin.txt.gpg

Decrypt your own file tecadmin.txt.gpg

–output or -o is used to specify output file name. Above command will prompt for passphrase used in key pair.

Step 3: Encrypt File for Other User

Generate Public Private Key Pair Linux Openssl

Use #1 steps to generate encrypted file. Finally share your public key and encrypted file ( tecadmin.txt.gpg ) with other users. /counter-strike-global-offensive-steam-key-generator-no-survey.html. To export your public key use following command.

Check your public key. It should be like below

Step 4: Decrypt Other Users File.

Generate Gpg Key In Linux

To decrypt other users file, It required public key of that user. Import that public key to your account using below command. For example other users public file is otherpub.txt

Make sure that file has been imported successfully using below command.

Gpg Key Server

Above command will show all public key in your account. Make sure the other users public key also exist there.

Gpg Gen Key

Now you can decrypt the other users file using below command

Generate Gpg Key Pair Linux Windows 10

Thank You for reading this article. Read our next article to File Encryption using GPG Command Line.