Skip to content

Instantly share code, notes, and snippets.

@camsaul
Last active February 27, 2019 06:13
Show Gist options
  • Save camsaul/77eeb569357ad8486858 to your computer and use it in GitHub Desktop.
Save camsaul/77eeb569357ad8486858 to your computer and use it in GitHub Desktop.
gpg2 commands
# export a public key
gpg2 --export --armor $KEY(S)
# import a public key
gpg2 --import $INPUT_FILE
# encrypt file
gpg2 --encrypt --armor --local-user $SENDER --recipient $RECIPIENT --output $OUTPUT_FILE $INPUT_FILE
# create detached signature for file
gpg2 --armor --detatch-sign --local-user $SENDER $FILE
# decrypt file
gpg2 --decrypt --output $OUTPUT_FILE $INPUT_FILE
# set the default key
echo "default-key $KEY" >> ~/.gnupg/gpg.conf
@camsaul
Copy link
Author

camsaul commented Jul 27, 2016

GPG keys for which you have both a public and private key

gpg2 --list-secret-keys --keyid-format LONG

@camsaul
Copy link
Author

camsaul commented Jul 27, 2016

Setup git to use gpg

git config --global commit.gpgsign true
git config --global user.signingkey <long-fingerprint>

https://help.github.com/articles/signing-commits-using-gpg/

@camsaul
Copy link
Author

camsaul commented Jul 27, 2016

Export a secret key

gpg2 --export-secret-key --armor <key>

@camsaul
Copy link
Author

camsaul commented Feb 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment