From b0719eacf984f83774507500640dfd39d473ce46 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 15 Aug 2014 12:59:07 -0400 Subject: Add encrypt/decrypt to attic. --- attic/decrypt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 attic/decrypt (limited to 'attic/decrypt') diff --git a/attic/decrypt b/attic/decrypt new file mode 100755 index 00000000..5af3acd4 --- /dev/null +++ b/attic/decrypt @@ -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 '' '[output]' + exit 1 +fi + +if [ ! -r "$1" ]; then + echo $0: $1 does not exist or is not readable. + exit 1 +fi + +outpath=`echo "$1" | sed 's/[.]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 -d -salt -in "$1" -out "$outpath" + +echo $0: wrote "$outpath" -- cgit v1.2.3