March 13, 2014

Encrypting Files with GnuPG

Generate private key.

$ gpg --gen-key

List all public keys.

$ gpg --list-keys

Export a public key.

$ gpg --armor --output "magnus.k.karlsson.txt.asc" --export "Magnus K Karlsson"

Import a public key from "Pelle Petterson".

$ gpg --import pelle.petterson.txt.asc

Encrypt a file for recipient "Pelle Petterson", with public key from "Pelle Petterson".

$ gpg --armor --recipient "Pelle Petterson" --output "foo.txt.gpg" --encrypt "foo.txt"

Decrypt a file, encrypted with your public key.

$ gpg --output "foo.txt" --decrypt "foo.txt.gpg"

No comments: