summaryrefslogtreecommitdiff
path: root/share/keyringer/encrypt
blob: b6d594cc02139679fd5b25ca11c322d515181267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
#
# Encrypt files to multiple recipients.
#

# Load functions
LIB="`dirname $0`/../../lib/keyringer/functions"
source $LIB || exit 1

# Aditional parameters
FILE="`keyringer_get_new_file $2`"

# Encrypt
mkdir -p $KEYDIR/`dirname $FILE`
echo "Type your message and finish your input with EOF (Ctrl-D)."
gpg --use-agent --armor -e -s $(keyringer_recipients $RECIPIENTS) - > $KEYDIR/$FILE

# Stage
if [ -d "$BASEDIR/.git" ]; then
  keyringer_exec git $KEYDIR add $FILE
fi