X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Famcrypt-ossl.sh.in;h=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hb=d92f70685083588e2a7ce6bc312a735f6937b5a6;hp=7f306527649176a75b651097ea9d1ce3fccaa9cb;hpb=6c1f39091444e58c33362f0cc086375d9d273e77;p=debian%2Famanda diff --git a/server-src/amcrypt-ossl.sh.in b/server-src/amcrypt-ossl.sh.in index 7f30652..e69de29 100644 --- a/server-src/amcrypt-ossl.sh.in +++ b/server-src/amcrypt-ossl.sh.in @@ -1,41 +0,0 @@ -#!@SHELL@ -# -# amcrypt-ossl.sh - crypto helper using OpenSSL -# Usage: amcrypt-ossl.sh [-d] -# - -# change these as needed -OPENSSL= # whatever's in $PATH -CIPHER=aes-256-cbc # see `openssl help` for more ciphers -AMANDA_HOME=~backup -RANDFILE=$AMANDA_HOME/.rnd -export RANDFILE -PASSPHRASE=$AMANDA_HOME/.am_passphrase # required - -# where might openssl be? -PATH=/bin:/usr/bin:/usr/local/bin:/usr/ssl/bin:/usr/local/ssl/bin -export PATH -ME=`basename "$0"` - -if [ -z "${OPENSSL:=`which openssl`}" ]; then - echo "${ME}: openssl not found" >&2 - exit 1 -elif [ ! -x "${OPENSSL}" ]; then - echo "${ME}: can't execute openssl (${OPENSSL})" >&2 - exit 1 -fi - -# we'll need to pad the datastream to a multiple of the cipher block size prior -# to encryption. 96 bytes (= 768 bits) should be good for any cipher. -pad() { - perl -pe 'BEGIN { $bs = 96; $/ = \8192 } $nbytes = ($nbytes + length) % $bs; END { print "\0" x ($bs - $nbytes) }' -} - -if [ "$1" = -d ]; then - # decrypt - "${OPENSSL}" enc -d "-${CIPHER}" -nopad -salt -pass fd:3 3< "${PASSPHRASE}" -else - # encrypt - pad | "${OPENSSL}" enc -e "-${CIPHER}" -nopad -salt -pass fd:3 3< "${PASSPHRASE}" -fi -