Skip to content

GPG

What Where
Official Page
Source
Download
Install

Using a symmetric cypher (AES 256)

Encrypt with symmetric cypher

gpg --symmetric --cipher-algo aes256 -o test.txt.gpg test.txt

Decrypt with symmetric cypher

gpg -d -o test.txt test.txt.gpg

Email setup

Generate Key

gpg --full-generate-key

Export Key

gpg --list-keys
gpg --output mygpgkey_pub.gpg --armor --export ABCDFE01
gpg --output mygpgkey_sec.gpg --armor --export-secret-key ABCDFE01

Alternativly output to console: gpg --armor --export ABCDFE01

Copy Keys

scp mygpgkey_pub.gpg mygpgkey_sec.gpg user@remotehost:~/

Import Key

gpg --import ~/mygpgkey_pub.gpg
gpg --allow-secret-key-import --import ~/mygpgkey_sec.gpg
rm ~/mygpgkey_sec.gpg ~/mygpgkey_pub.gpg
gpg --list-keys

Publish Public Key to Key Server

Key Server

Public Key Server Services

gpg --keyserver keyserver.ubuntu.com --send-keys 8CC3D3CDE700B7DE

Search entry on Key Server

gpg --keyserver hkp://keyserver.ubuntu.com --search-key '[email protected]'

Alternativly use the webinterface e.g. https://keys.mailvelope.com/pks/lookup?op=get&[email protected]

Empty file and no PW

It is possible to use GPG without password and even for an empty file:

touch test.txt
gpg --store --armor test.txt

This creates a file called "test.txt.asc" that looked like this:

-----BEGIN PGP MESSAGE-----

owE7zZfEUZJaXKJXUlGSItEdCwA=
=LlM4
-----END PGP MESSAGE-----

Decrypting works too :)

gpg -d test.txt.asc

... and cat test.txt shows an empty file again :)