bgul notes: encryption

Using GPG

Alice wants to send encrypted message to Bob. Bob needs to generate key pair and send public key to Alice.

Bob:

# first generate key
bob$ gpg --gen-key

# then see if your key was added to keyring
bob$ gpg --list-keys
/home/bob/.gnupg/pubring.gpg
------------------------------
pub  1024A/BBE5BA2A 2009-01-14 Bob (Bob's GPG key pair) 
sub  1024g/38681206 2001-01-14

# now, export your public key and send it via email to Alice
bob$ gpg --armor --export bob@bob.com > bobs_public.key 

Alice reads her email, and saves bobs_public.key to disk. Alice:

# import Bob's public key
alice$ gpg --import bobs_public.key

# optionally see fingerprint and add to trusted keys
alice$ gpg --edit-key bob@bob.com
> fpr
> sign
> quit

 # let's encrypt some secrets
alice$ gpg --out secrets_for_bob.pgp --encrypt secrets.txt 

Now Bob when receives secretsforbob.pgp can do:

bob$ gpg --out secrets.txt --decrypt secrets_for_bob.pgp

bob$ cat secrets.txt
I love you!

Encrypting hard disks / pendrives / SD cards

Excelent example here

Posted by Hubert Łępicki Wed, 14 Jan 2009 15:03:00 GMT


Comments

Leave a response

Leave a comment