aboutsummaryrefslogtreecommitdiff
path: root/scripts/encrypt
blob: d5a2e1c1e739550e0ddc8dc5ce7390eb00504b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
# encrypt to multiple recipients

FILE="$1"
BASENAME="`basename $0`"
RECIPIENTS="config/recipients"

if [ -z "$FILE" ]; then
  echo "Usage: `basename $0` <file>"
  exit 1
elif [ ! -f "$RECIPIENTS" ]; then
  echo "No recipient config was found"
  exit 1
fi

mkdir -p keys/`dirname $FILE`
recipients="$(awk '{ print "-r " $2 }' $RECIPIENTS | xargs)"
echo "Type your message and finish your input with EOF (Ctrl-D)."
gpg --armor -e -s $recipients - > keys/$FILE