PGP/GPG Encryption

Public/Private keys are used to send encrypted data between clients. The receiving client generates public/private key pair and sends the public key to all contributing clients. The contributing clients are using public key to decrypt the file. Receiving client is using the private key to encrypt the file. Private key should never be send to anyone outside!

How to start?

Download latest version of GnuPG from

General Help

gpg --help

Creating public/private(secret) key

gpg --gen-key

Listing public/private keys

gpg --list-keys

Exporting public key

gpg --armor --export test@email > public.key

Exporting private key

gpg --armor –export-secret-key test@email > public.key

Importing keys

gpg -–import key.txt

Deleting secret key

gpg --delete-secret-keys test@email

Deleting public key

gpg --delete-keys test@email

Change passphrase

gpg --edit-key test@email passwd

Encrypt file

gpg --batch --output "<outfile>" --encrypt --recipient test@email "<infile>"

Encrypt file with different cipher algorithm

gpg --batch --output "<outfile>" --encrypt --cipher-algo AES --recipient test@email "<infile>"

Decrypt file

gpg --batch --output "<outfile>" --decrypt "<infile>"


Popular posts from this blog

Parse XML to dynamic object in C#

C# Updating GUI from different thread