diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-08-15 12:59:07 -0400 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-08-15 12:59:07 -0400 |
commit | b0719eacf984f83774507500640dfd39d473ce46 (patch) | |
tree | 033de24c99f56d34984e72d8d26e39d8df3abc55 /attic/encrypt | |
parent | c2187c87599c60b9c47dd9d01244ce1ffd105fea (diff) | |
download | infinitytier-b0719eacf984f83774507500640dfd39d473ce46.tar.gz infinitytier-b0719eacf984f83774507500640dfd39d473ce46.zip |
Add encrypt/decrypt to attic.
Diffstat (limited to 'attic/encrypt')
-rwxr-xr-x | attic/encrypt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/attic/encrypt b/attic/encrypt new file mode 100755 index 00000000..243a46d7 --- /dev/null +++ b/attic/encrypt @@ -0,0 +1,32 @@ +#!/bin/bash + +export PATH=/bin:/usr/bin + +if [ ! -e /usr/bin/openssl ]; then + echo $0: requires /usr/bin/openssl, please install openssl tools + exit 1 +fi + +if [ "$#" -lt 1 ]; then + echo $0: Usage: $0 '<input>' '[output]' + exit 1 +fi + +if [ ! -r "$1" ]; then + echo $0: $1 does not exist or is not readable. + exit 1 +fi + +outpath="$1.aes" +if [ "$#" -ge 2 ]; then + outpath="$2" +fi + +if [ -f "$outpath" ]; then + echo $0: $outpath already exists, delete or rename first. + exit 1 +fi + +openssl aes-256-cbc -salt -in "$1" -out "$outpath" + +echo $0: wrote "$outpath" |