Memo GPG


Keys management :
  • Help on gpg : gpg --help
  • Generate key pair : gpg --gen-key
  • Revoke a key : gpg --gen-revoke
  • List public keys : gpg --list-key
  • Key management : gpg --edit-key [id] (adduid | trust | save | quit)
  • Send a public key to a server : gpg --keyserver [pgp.mit.edu] --send-key [uid]
  • Get a Key from a server : gpg --keyserver [pgp.mit.edu] --recv-keys [uid]
Keys manipulation :
  • Export a public key in a file : gpg --export --armor [uid] > [outfile]
  • Import a public key from a file : gpg --import [outfile]
  • Export a private key to a file : gpg --export-secret-key -a > [outfile]
  • Import a private key from a file : gpg --import --allow-secret-key-import [infile]
  • Extract the fingerprint of the public key : gpg --fingerprint [uid] > [outfile]

Trusted network :
  • Sign a third-person public key : gpg --sign-key [uid]
  • List signatures : gpg --list-sigs
  • Check signatures : gpg --check-sigs [uid]
Signing, encrypting, decrypting :
  • Sign a file : gpg --clearsign -a [signed_file]
  • Create signature of a file : gpg -b -a [uid] -o [outfile] [file to sign]
  • Encrypt a file : gpg -r [uid] -e -a -o [outfile] [infile]
  • Encrypt and sign a file : gpg -s -a --encrypt [infile]
  • Check separated signature : gpg --verify [signature_file] [signed_file]
  • Check included signature : gpg --verify [infile]
  • Decrypt a file : gpg -r [uid] -d -o [outfile] [infile]

Visit GPG web site for more informations.