Skip to content

Instantly share code, notes, and snippets.

@palmerabollo
Last active August 29, 2015 14:14
Show Gist options
  • Save palmerabollo/36209619a2338662c7c3 to your computer and use it in GitHub Desktop.
Save palmerabollo/36209619a2338662c7c3 to your computer and use it in GitHub Desktop.
# prerequisites: curl, jq (brew install jq), openssl
echo "To:"
read EMAIL
# retrieve user info (login+ssh key) from github
LOGIN=`curl -s https://api.github.com/search/users?q=$LOGIN | jq -r '.items[0].login'`
KEY=`curl -s https://api.github.com/users/$LOGIN/keys | jq -r '.[0].key'`
echo $KEY > $LOGIN.pub
# TODO check LOGIN & KEY
echo $KEY
ssh-keygen -f $LOGIN.pub -e -m PKCS8 > $LOGIN.pem # THIS DOES NOT WORK
echo "Message:"
read MESSAGE
echo "Encrypted message"
echo $MESSAGE | openssl rsautl -encrypt -pubin -inkey $LOGIN.pem -ssl
# TODO open github issue
# cleanup
rm $LOGIN.pub
rm $LOGIN.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment