zsmith.co

GNU Privacy Guard (GPG) Quick Reference Et Cetera.

Revision 3
© 2014-2019 by Zack Smith. All rights reserved.

Handy GPG commands

To encrypt a file with a password gpg -c file
To decrypt a file using a password gpg -d file
To import someone's public key gpg --import public.key
To show all the keys you have gpg --list-keys
To print your public key as ASCII gpg --armor --export
To encrypt a file you are sending to someone gpg -e -u Sender Name -r Receiver Name filename
To encrypt a file using your private key gpg -e file
To decrypt a file using your private key gpg -d file
To create a new public and private key pair associated with an email address gpg --gen-key

OpenSSL for encrypt and decrypt files

To encrypt:

openssl des3 -salt -out file.des3 -in file.zip

To decrypt:

openssl des3 -salt -d -in file.des3 -out file2.zip

Encrypted USB thumb drives on Linux

To wipe the drive sudo dd if=devzero of=devsdX count=10000
To set up encryption on the drive sudo cryptsetup luksFormat devsdX
To open and name the drive sudo cryptsetup luksOpen devsdX DriveName
To format the opened drive's partition sudo mkfs -t ext4 devmapper/DriveName
To mount the drive sudo mount devmapper/DriveName usb
To unmount the drive sudo umount usb