GPG Guide

You can encrypt/decrypt your files with GPG.

1. Creating GPG Key

Run gpg --full-gen-key and answer questions.

IMPORTANT key-id = keys' mail

1.1. Creating Backup for a GPG Key

1.1.1. Creating Backup File

gpg --export-secret-keys --output private-key.asc --armor [key-id]

1.1.2. Importing Backup File

gpg --allow-secret-key-import --import private-key.asc

[!WARNING] You should store this private-key.asc file in a safe storage like your USB. Don't upload it to Drive etc., if you want to do that, you can upload it as encrypted zip file.

2. Exporting and Importing Public Keys

You can share your public key. With public key, people can encrypt files for you.

You can find people's keys in https://keys.openpgp.org. Just type an email, you'll see GPG key. For example, you can try typing rootww@duck.com for my GPG key.

If you encrypt a file with your key, only YOU can decrypt it.

2.1. Exporting Public Key

gpg --armor --output [keyname].key --export [key-id]

2.2. Importing Public Key

gpg --import [keyname].key

3. Encrypt and Decrypt Files

3.1 Encrypting Files

gpg -r [key-id] --encrypt [non-encrypted file]

For example, you have my key. (As I said, you can find in OpenPGP Keys page.) You can encrypt a file for me with rootww@duck.com key-id.

3.2 Decrypt Files

gpg --decrypt [encrypted file] --output [output file]

If file is encrypted for you, you can decrypt it with this command. But don't forget, you should have your private key to decrypt.