Gnupg

From MattWiki
Jump to: navigation, search

GPG allows you 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. If interested, also read more about PGP Keyservers and the SKS Keyserver.

GPG Command Line Program

Encrypting a File

gpg -e -r <Key-ID> <File-Name>

Signing a File

gpg -s -r <Key-ID> <File-Name>

Encrypting & Signing a File

gpg -es -r <Key-ID> <File-Name>

Verifying a Signature

gpg --verify <File-Name>

Decrypting a File

gpg -d <File-Name>

Signing a Key Locally

gpg --lsign-key <Key-ID>

Refresh Public Keys from Key Servers

gpg --refresh-keys

Exporting a Public Key to a file

gpg --export <Key-ID> > <Key-ID>.pub.asc

Exporting a Public Key to a Key Server

gpg --keyserver keys.gnupg.net --send-keys <Key-ID>

Importing a Public Key from a File

gpg --import <Key-ID>

Importing a Public Key from a Key Server

gpg --search-keys [<Key-ID> OR <Email Address>]

Or you may add the key server url

gpg --keyserver hkp://keys.gnupg.net --search-keys [<Key-ID> OR <Email Address>]

Setting Trust Level on a Key

gpg --edit-key <Key-ID>

  Command> trust
     1 = I don't know or won't say
     2 = I do NOT trust
     3 = I trust marginally
     4 = I trust fully
     5 = I trust ultimately
     m = back to the main menu
  Your decision? 5 
  Do you really want to set this key to ultimate trust? (y/N) y
  Command> save

gpg --update-trustdb

Creating a new Private Key

gpg --gen-key