Tags

, ,

This guide should be good for most major distros out there but I have only tested it so far in centos 6. Sadly, there is a strange error message I am getting when decrypting that I have yet to discover how to fix, if anyone knows anything about it feel free to let me know, I will update if I find a workaround:

Create a file

touch foo

open the file

nano foo

write example text, I used

I’m on an encrypted system now.

Close the file and get ready to generate your key, but first verify that you have gpg installed

which gpg

It should show it in some place like /bin, if not install it. Assuming it was there type

gpg –gen-key

it asked me what type I wanted I choose 2, which is DSA only.

2

Now it asks me the key size, I choose the maximum of 3072

3072

Now, it asks me for the duration of time the key will be valid, I choose 6 months

6m

It asks me to confirm

Y

It asks me for my real name

John Q. Public

It asks me for my email address

root@mailserver.net

it asks me to comment

temp key, used for one project

it gives me several options to correct it, everything looked fine so I selected O for okay

O

It asks me for a passphrase

Very LoNg password with 55 numbERS

It will now tell me to generate entropy, I used a floating point benchmark test and a lot of random typing to do this. After it is done, I test it on my file

gpg –c foo

it will prompt me for my passphrase twice and after I enter it, I check my directory

ls

and I see my encrypted file

foo.gpg

now, I want to decrypt it

gpg –o goo –d foo.gpg

I am asked my pass phrase

And I view my file

cat goo

now, I am assuming you are just going to use this key with a few people, so first we export our public key

gpg –armor –export > /home/myname/mypublickey

if you would open this file you will see the public key, which you can send out.

REFERENCES:

http://www.centos.org/docs/4/html/rhel-sbs-en-4/s1-gnupg-import.html