Skip to content

Instantly share code, notes, and snippets.

@hudon
Created May 12, 2015 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hudon/d451cd869bde8ed85623 to your computer and use it in GitHub Desktop.
Save hudon/d451cd869bde8ed85623 to your computer and use it in GitHub Desktop.
hybrid decrypt
# decrypt /path/to/decrypted/target
# assumes existence of target.iv, target.key (aes-256-cbc), target.enc (encrypted target)
decrypt () {
local IV=`base64 -d < "$1.iv" | openssl rsautl -decrypt \
-inkey /etc/ssl/private/private.key`
local KEY=`base64 -d < "$1.key" | openssl rsautl -decrypt \
-inkey /etc/ssl/private/private.key`
openssl aes-256-cbc -d -a -in "$1.enc" -out "$1" -iv "$IV" -K "$KEY"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment