Gnupg memo

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#

Gnupg memo

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