]>
git.sthu.org Git - pgp-tools.git/blob - gpg-mailkeys/gpg-mailkeys
8 echo "Send people their newly signed GPG key by mail."
9 echo "Usage: $0 keyid ..."
13 if [ -e ~
/.gpg-mailkeysrc
] ; then
16 if [ -n "$EMAIL" ]; then
19 if [ -z "$SUBJECT" ]; then
20 SUBJECT
="Your signed GPG key"
22 if [ -z "$NAME" ]; then
23 NAME
=`getent passwd $USER | cut -d: -f5 | cut -d, -f1`
25 if [ -z "$TEXT" ]; then
28 Here is your signed GPG key.
38 TEMPFILE
=`mktemp -t gpg2mail.XXXXXX`
39 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`
40 if [ -z "$ADDR" ]; then
41 echo "(no usable user ids)"
42 FAILKEYS
="$FAILKEYS:$1"
46 BOUNDARY
="ksp-$$-boundary-$RANDOM"
50 echo >$TEMPFILE "From: $NAME <$FROM>"
52 cat << EOM >> $TEMPFILE
55 User-Agent: gpg-mailkeys/$VERSION
57 Content-Type: multipart/mixed; micalg=pgp-sha1;
58 protocol="application/pgp-signature"; boundary="$BOUNDARY"
59 Content-Disposition: inline
64 Content-Type: text/plain; charset=us-ascii
65 Content-Disposition: inline
66 Content-Transfer-Encoding: quoted-printable
73 if [ -f ~
/.signature
];
74 then echo "--=20" >> $TEMPFILE
75 cat ~
/.signature
>> $TEMPFILE
78 cat << EOM >> $TEMPFILE
81 Content-Type: text/plain; charset=us-ascii
82 Content-Disposition: attachment; filename="$1.sig"
84 `gpg --armor --export $1`
89 /usr
/sbin
/sendmail
-t <$TEMPFILE
95 if [ -n "$FAILKEYS" ]; then
97 echo "Note: The following keys could not be sent:"
98 echo "$FAILKEYS" |
tr ':' '\n' |
sed -e '/^ *$/d' -e 's/^/ /'