Home > Uncategorized, Unix > Set up Pretty Good Privacy (PGP) Key in Ubuntu

Set up Pretty Good Privacy (PGP) Key in Ubuntu

 

 

Pretty Good Privacy (PGP) is a data encryption and decryption computer program that provides cryptographic privacy and authentication for data communication. PGP is often used for signing, encrypting, and decrypting texts, e-mails, files, directories, and whole disk partitions and to increase the security of e-mail communications. [1]

 

In our case we would use GNU OpenPGP implementation which is Gnu pg or gpg. GnuPG allows to encrypt and sign your data and communication, features a versatile key management system as well as access modules for all kinds of public key directories. [2]

Generate PGP keys

 

# Command to create gpg key

gpg  –gen-key

 

Before you hit this command, you may need to install rng-tools. During the key generation operation, your system tells you that no more random bytes are available and that it needs to collect more entropy, and you are stuck. rng-tools helps in this regards. First we need to install rng-tools and need to updated /etc/default/rng-tools file  to add the line HRNGDEVICE=/dev/urandom. Follow [3] for details.

 

sudo apt-get install rng-tools

#start the service

sudo /etc/init.d/rng-tools start

 

 

Now, gpg  –gen-key would possibly work successfully.

 

Screenshot 2016-03-28 22.20.55.png

Generating pgp key

 

 

Publish PGP key:

 

 

To publish GPG keys in ubuntu server, run following commands

gpg --keyserver keyserver.ubuntu.com --send-keys 47BBA6FC
Your public key (fingerprint) would look something like following



Screenshot 2016-03-28 22.29.30.png

Listing pgp fingerprint

 

Finally, you can make sure your public key exists on the ubuntu server by
searching it with your email address.

 

 

Screenshot 2016-03-28 22.31.26.png

Searching gpg key by email address


 

Now hopefully, you can find your pgp keys on the server. So, finally, you
a public key of your own published.

 

Export and Import Public and Private keys:

#export public key

gpg –export -a “name of key holder” > public.key

#import private key

gpg –export-secret-key -a”name of key holder” > private.key

 

Reference:

[1] https://en.wikipedia.org/wiki/Pretty_Good_Privacy

[2] https://www.gnupg.org/

[3] https://www.howtoforge.com/helping-the-random-number-generator-to-gain-enough-entropy-with-rng-tools-debian-lenny

[4] https://help.ubuntu.com/community/GnuPrivacyGuardHowto

[5] http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html

Advertisements
Categories: Uncategorized, Unix
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: