Last active
August 29, 2015 14:14
-
-
Save palmerabollo/36209619a2338662c7c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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