Skip to content

Instantly share code, notes, and snippets.

@andmax
Created March 30, 2021 14:09
Show Gist options
  • Save andmax/a334c1606297846edbace553d73c015b to your computer and use it in GitHub Desktop.
Save andmax/a334c1606297846edbace553d73c015b to your computer and use it in GitHub Desktop.
GPG public/private keys for file encryption
# First generate a public/private key pair
gpg --full-generate-key
# Export your public and private keys
gpg --export --armor --output <name>.gpg.pub
gpg --export-secret-keys <your_email> > <name>.gpg.key
# Import a private key on another machine
gpg --import <name>.gpg.key
# Encrypt a file name with you (your email) as recipient
gpg -r <your_email> --encrypt <file_name>.tgz
# Decrypt a file name using the password-protected key (stored in database)
gpg --decrypt <file_name>.tgz.gpg > <file_name>.tgz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment