Home > bash > GPG notes

GPG notes

GPG Notes

1. Getting a gpg public key
You need to know the recipients key id

gpg2 --keyserver pgp.mit.edu --recv-keys <recipient_key_id>

2. Sending a gpg public key to a key server

gpg2 --keyserver hkp://pgp.mit.edu --send-keys <key_id>

3. Encrypt a file (I locked myself out doing this. So if you want to read that file again later use the other option below)

gpg2 --output file.txt.gpg --sign --encrypt --recipient <recipient_key_id> 
--recipient <recipient_key_id> file.txt

4. Encrypt a file that you would later want to decrypt

gpg2 --output file.txt.gpg --sign --encrypt --recipient(yourself) <your_key_id> 
--recipient <recipient_key_id> --recipient <recipient_key_id> file.txt

More reading
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/sect-Security_Guide-Encryption-GPG-Creating_GPG_Keys_using_the_Command_Line.html

Creating a new GPG key with subkeys

Advertisements
Categories: bash
  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: