#! /bin/bash
#
usage()
{
echo "Usage: encrypt foo .. encrypts foo, stores in foo.enc"
echo " encrypt -d foo.enc .. decrypts foo.enc, stores in foo"
echo " encrypt -c foo.enc .. decrypts foo.enc, writes to stdout"
}
if [ $# -eq 1 -a "$1" = "-h" ]
then
usage
elif
[ $# -eq 2 -a "$1" = "-c" ]
then
openssl enc -d -des3 -in $2
elif
[ $# -eq 2 -a "$1" = "-d" ]
then
openssl enc -d -des3 -in $2 -out ${2%.enc}
elif
[ $# -eq 1 -a -f "$1" ]
then
openssl enc -e -des3 -salt -in $1 -out $1.enc
else
usage
fi
没有评论:
发表评论