blob: b8c037529bc6a72535441d8a42ee56c854a90ca2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
Index: signing-party-1.1.3/gpg-mailkeys/gpg-mailkeys
===================================================================
--- signing-party-1.1.3.orig/gpg-mailkeys/gpg-mailkeys
+++ signing-party-1.1.3/gpg-mailkeys/gpg-mailkeys
@@ -58,19 +58,21 @@ if [ -z "$TEXT" ]; then
Here is your signed GPG key.
-Enjoy,
+Regards,
$NAME"
fi
get_local_charset
FAILKEYS=
+# Contains all the mail addresses for a specific key id
+ADDR=`gpg --with-colons --fixed-list-mode --list-key $1 | sed -e 's/^uid:[^re][^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:<]*<[^:>]*>\):.*/@@uid@@ \1/' -e '/^@@uid@@ /!d' -e 's/([^)]*)//g' -e 's/ */ /g' -e 's/^@@uid@@ //' -e 's/.*< *//' -e 's/ *>.*//'`
while [ -n "$1" ]; do
+ for addr in ${ADDR}; do
printf "[$1] "
TEMPFILE=`mktemp -t gpg2mail.XXXXXX`
- ADDR=`gpg --with-colons --fixed-list-mode --list-key $1 | sed -e 's/^uid:[^re][^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:<]*<[^:>]*>\):.*/@@uid@@ \1/' -e '/^@@uid@@ /!d' -e 's/([^)]*)//g' -e 's/ */ /g' -e 's/^@@uid@@ //' | head -1`
- if [ -z "$ADDR" ]; then
+ if [ -z "$addr" ]; then
printf "(no usable user ids)\n"
FAILKEYS="$FAILKEYS:$1"
shift 1
@@ -79,12 +81,15 @@ while [ -n "$1" ]; do
NANOTIME=`date +%s-%N`
BOUNDARY="ksp-$$-boundary-$NANOTIME"
- printf "$ADDR:"
+ printf "$addr:"
if [ $FROM ]; then
printf >$TEMPFILE "From: $NAME <$FROM>\n"
fi
+
+gpg --armor --export ${addr} >> /tmp/$1.asc
+
cat << EOM >> $TEMPFILE
-To: $ADDR
+To: $addr
Subject: $SUBJECT
User-Agent: gpg-mailkeys/$VERSION
MIME-Version: 1.0
@@ -113,9 +118,9 @@ cat << EOM >> $TEMPFILE
--$BOUNDARY
Content-Type: application/pgp-keys
-Content-Disposition: attachment; filename="$1.asc"
+Content-Disposition: attachment; filename="$1.asc.gpg"
-`gpg --armor --export $1`
+`gpg --encrypt --recipient ${addr} /tmp/$1.asc; cat /tmp/$1.asc.gpg`
--$BOUNDARY--
EOM
@@ -123,7 +128,11 @@ EOM
/usr/sbin/sendmail -ti <$TEMPFILE
rm $TEMPFILE
printf " done.\n"
- shift 1
+ # clean up file
+ rm /tmp/$1.asc
+ rm /tmp/$1.asc.gpg
+ done
+ shift 1
done
if [ -n "$FAILKEYS" ]; then
|