summaryrefslogtreecommitdiff
path: root/attic/encrypt
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-08-15 12:59:07 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-08-15 12:59:07 -0400
commitb0719eacf984f83774507500640dfd39d473ce46 (patch)
tree033de24c99f56d34984e72d8d26e39d8df3abc55 /attic/encrypt
parentc2187c87599c60b9c47dd9d01244ce1ffd105fea (diff)
downloadinfinitytier-b0719eacf984f83774507500640dfd39d473ce46.tar.gz
infinitytier-b0719eacf984f83774507500640dfd39d473ce46.zip
Add encrypt/decrypt to attic.
Diffstat (limited to 'attic/encrypt')
-rwxr-xr-xattic/encrypt32
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"