Skip to content

Instantly share code, notes, and snippets.

@leetrout
Created August 7, 2012 19:33
Show Gist options
  • Save leetrout/3288679 to your computer and use it in GitHub Desktop.
Save leetrout/3288679 to your computer and use it in GitHub Desktop.
OpenSSL encryption helper scripts

Sometimes I use this automagically from a script... Just toss in the -kfile flag.

Decrypt:

#!/bin/bash
openssl enc -aes-256-cbc -d -kfile /path/to/passwd_in_file.txt -in $1 -out `echo $1 | sed s/.enc//`

Encrypt:

#!/bin/bash
openssl enc -aes-256-cbc -kfile /path/to/passwd_in_file.txt -in $1 -out $1.enc
#!/bin/bash
openssl enc -aes-256-cbc -d -in $1 -out `echo $1 | sed s/.enc//`
#!/bin/bash
openssl enc -aes-256-cbc -in $1 -out $1.enc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment