Below is a list of main commands for operating GnuPG
Generate double keys:
$ gpg –gen-key
List available keys:
$ gpg –list-keys
Exporting your public key:
$ gpg –armor –export #KEYID#
Importing a key:
$ gpg –import filename
Calculating the fingerprint of a key:
$ gpg –fingerprint #KEYID#
Signing a key:
$ gpg –sign-key #KEYID#
Encrypt and signing a message:
$ gpg -sea -r #KEYID#
then type the message followed by key button CTRL+Z
Signing a public message:
$ gpg –clearsign -a -r #KEYID#
then type the message followed by key CTRL+Z
Encrypting a file (you must have the recipient’s key on the keyring):
$ gpg –encrypt –recipient mezgani@toto.ma file
Decrypt a message/verify signature:
$ gpg < message.txt
Decrypt a file with password:
$ gpg filename
Sign a file (signature in a separate file):
$ gpg –armor –detach-sign filename
(This will be created as filename.asc with the message)
Verifying detached signature file .asc:
$ gpg filename.asc
Exporting the key to the file toto:
$ gpg –output toto –export-secret-key #KEYID#
Importing a secret key from the file toto:
$ gpg –import toto
How can I add a UID to my key:
$ gpg –edit-key #KEYID#
Command> adduid
…
Command> save
Exporting the public key to the keyservers “subkeys.pgp.net”:
$ gpg –keyserver subkeys.pgp.net –send-keys #KEYID#