Skip to content

Instantly share code, notes, and snippets.

@smashwilson
Forked from rgbkrk/hubdecrypt.sh
Created December 6, 2013 16:45
Show Gist options
  • Save smashwilson/7828031 to your computer and use it in GitHub Desktop.
Save smashwilson/7828031 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
key=$1
infile=$2
outfile=$3
openssl rsautl -decrypt -inkey $key -in $infile -out $outfile
#!/usr/bin/env bash
user=$1
infile=$2
outfile=$2.enc
wget github.com/$user.keys -O id_rsa.pub
# Encrypt
# Need a pem file
ssh-keygen -f id_rsa.pub -e -m PKCS8 > id_rsa.pem.pub # make a pem file
openssl rsautl -encrypt -pubin -inkey id_rsa.pem.pub -ssl -in $infile -out $outfile
## Decrypt
### openssl rsautl -decrypt -inkey ~/.ssh/id_rsa -in totallysecret.txt.enc -out totallysecret.txt # decrypt, yay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment