Skip to content

Instantly share code, notes, and snippets.

@larsxschneider
Created June 3, 2020 06:31
Show Gist options
  • Save larsxschneider/be011886b8bff2f5c4428655ec66f835 to your computer and use it in GitHub Desktop.
Save larsxschneider/be011886b8bff2f5c4428655ec66f835 to your computer and use it in GitHub Desktop.
Encrypt a file to send it securely to another Hubber
#!/usr/bin/env bash
# Encrypt a file to send it securely to another Hubber
#
# Use https://gpgtools.org/ to an easy to use decryption UI.
#
# Usage:
# enc4hub larsxschneider /path/to/file
#
set -e
recipient=$1
file=$2
# Import the public key of the recipient from GitHub
gpg --import <(curl --silent https://github.com/$recipient.gpg)
# Encrypt the file with the recipient's key and sign it with my own key
gpg --encrypt --sign --armor --trust-model always --recipient $recipient@github.com "$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment