GPG Cheat Sheet Link to heading

More information :

Summary Link to heading

Config file Link to heading

Create gpg.conf Link to heading

touch ~/.gnupg/gpg.conf

Add content Link to heading

default-key ID_KEY

personal-cipher-preferences AES256 AES 3DES

personal-digest-preferences SHA512 SHA384 SHA256

personal-compress-preferences ZLIB BZIP2 ZIP Uncompressed

default-preference-list SHA512 SHA384 SHA256 AES256 AES 3DES ZLIB BZIP2 ZIP Uncompressed

Commands Link to heading

Generate GPG key pair with full option Link to heading

gpg --full-gen-key

Generate GPG key pair Link to heading

gpg --gen-key

List key pair Link to heading

gpg --list-keys

List public keys Link to heading

gpg -k

List private keys Link to heading

gpg -K 

Find fingerprint Link to heading

gpg --fingerprint ID_KEY

Export public key in a file Link to heading

gpg --export --armor ID_KEY > out.key

Import public key from a file Link to heading

gpg --import file.key

List key pair Link to heading

gpg --list-keys

Export private key in a file Link to heading

gpg --export-secret-key -a > out.key

Import private key from a file Link to heading

gpg --import --allow-secret-key-import fichier_cle.key

Sign a file Link to heading

gpg -s -u ID_KEY file
gpg -s file (with default key)

Encrypt a file Link to heading

gpg -r ID_KEY -e -a file

Encrypt and sign a file Link to heading

gpg -s -a -e -u ID_KEY file

Decrypt a file Link to heading

gpg -r ID_KEY -d file

Verify external signature Link to heading

gpg --verify file file_sign

Verify Signature Link to heading

gpg --verify file

Delete key (public & private) Link to heading

gpg --delete-secret-keys ID_KEY
gpg --delete-key ID_KEY

Find technical information Link to heading

gpg --edit-key ID_KEY
  • Verify signature of a key
> check
  • List preferences
> pref
> showpref

Change passphrase of private key Link to heading

gpg --edit-key ID_KEY
> passwd
> save 

Sign a public key Link to heading

gpg --sign-key ID_KEY_TO_SIGN

Verify key signature Link to heading

gpg --edit-key ID_KEY_
> check