How to configure GNU Privacy Guard (GPG) and create a encrypted file

GNU Privacy Guard - (GPG)

GnuPG is an implementation of the OpenPGP standard (also known as PGP). For more information and documentation, see the GnuPG site.

 

By default, this utility is available in almost all of the Linux/Unix operating systems.

  1. To verify if the GPG utility is installed, run the command which gpg. In general, you should find it in /usr/bin/.

     

    1.png

     

  2. To create a GPG key, run the following command:

    2.png

    At the prompt, specify the kind of key you want, or press Enter to accept the default RSA and RSA.

     

  3. Enter the desired key size. Talend recommends the maximum key size of 4096.

    3.png

     

  4. Enter the length of time the key should be valid. Press Enter to specify the default selection, indicating that the key doesn't expire (0).

  5. Enter the Real name (enter any name, at least 5 characters are required).

  6. Provide the email id (any vaild email id can be provided).

    4.png

    Verify that your selections are correct.

     

  7. Type the letter O for Okay.

  8. Provide a passphrase. Using at least eight characters is recommended as a best practice.

    5.png

     

  9. You will be prompted to type the passphrase again.

  10. Verify that the key was generated successfully by running the following command:

    6.PNG

 

Encryption

Now that you have created the key, you can encrypt any file by following these steps.

  1. Create a simple text file and enter any data, for example Hi, this is gpg encryption test.
  2. Encrypt the file using the following syntax:

    gpg --batch --yes --recipient user-id --output Absolute path/XXX.pgp –encrypt Absolute path/xxxxxx.txt

    For example, this command will create a file named test.pgp:

    gpg --batch --yes --recipient a@b.com --output /root/Talend6.3.1/test.pgp --encrypt /root/Talend6.3.1/test.txt

     

  3. You can verify the file running the command:

    gpg -d Absolute path/test.pgp

     

    You will be prompted to provide the passphrase you used while creating the GPG key:

    7.png

Version history
Revision #:
4 of 4
Last update:
‎02-05-2018 03:44 PM
Updated by:
 
Contributors