Skip to content

Instantly share code, notes, and snippets.

@chavafg
Last active June 26, 2019 20:02
Show Gist options
  • Save chavafg/b22626a2f4554c13f033f60159930ac8 to your computer and use it in GitHub Desktop.
Save chavafg/b22626a2f4554c13f033f60159930ac8 to your computer and use it in GitHub Desktop.
message="message.txt"
encrypted_msg="message.gpg"
receiver_pub_key="receiver_key.pub"
receiver_email="[email protected]"
# 1. Receiver - Create public key.
gpg --gen-key
# 2. Receiver - Export public key and share it with the Sender
gpg --armor --output "$receiver_pub_key" --export "$receiver_email"
# 3. Sender - import gpg key from receiver.
gpg --import "$receiver_pub_key"
# 4. Sender - Encrypt message to be sent.
gpg --output "$encrypted_msg" --encrypt --recipient "$receiver_email" "$message"
# 5. Sender - Send encrypted message to the receiver.
# 6. Receiver - Decrypt the message.
gpg --output message --decrypt "$encrypted_msg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment