From 4b32032b04fe6bf1b6c1aa979f871fcd313e0476 Mon Sep 17 00:00:00 2001 From: kink-guest Date: Thu, 2 Jun 2005 23:13:36 +0000 Subject: [PATCH] Add gpg-key2ps and gpg-mailkeys from the signing-party package. I'm including gpg-mailkeys even though it has some overlapping functionality with caff, because the first aim should be to create a package that does at least the same as signing-party. git-svn-id: svn://svn.debian.org/pgp-tools/trunk@44 b513b33f-fedd-0310-b452-c3deb5f4c849 --- README | 2 + gpg-key2ps/README | 44 ++++++ gpg-key2ps/gpg-key2ps | 228 ++++++++++++++++++++++++++++ gpg-key2ps/gpg-key2ps.1 | 40 +++++ gpg-mailkeys/README | 41 +++++ gpg-mailkeys/example.gpg-mailkeysrc | 17 +++ gpg-mailkeys/gpg-mailkeys | 99 ++++++++++++ gpg-mailkeys/gpg-mailkeys.1 | 21 +++ 8 files changed, 492 insertions(+) create mode 100644 gpg-key2ps/README create mode 100755 gpg-key2ps/gpg-key2ps create mode 100644 gpg-key2ps/gpg-key2ps.1 create mode 100644 gpg-mailkeys/README create mode 100644 gpg-mailkeys/example.gpg-mailkeysrc create mode 100755 gpg-mailkeys/gpg-mailkeys create mode 100644 gpg-mailkeys/gpg-mailkeys.1 diff --git a/README b/README index 7bc04a1..d85bd2b 100644 --- a/README +++ b/README @@ -2,6 +2,8 @@ This repository is home for several projects relating to OpenPGP. * caff -- CA - fire and forget * gpgsigs -- annotate list of GnuPG keys with already done signatures +* gpg-key2ps -- generate PostScript file with fingerprint paper strips +* gpg-mailkeys -- simply mail out a signed key to its owner Please note that each individual project has its own license, please consult the licensing information in the subdirectories. diff --git a/gpg-key2ps/README b/gpg-key2ps/README new file mode 100644 index 0000000..94a2558 --- /dev/null +++ b/gpg-key2ps/README @@ -0,0 +1,44 @@ +gpg-key2ps +---------- + +Usage: gpg-key2ps [-p papersize] [-r revoked-style] keyid-or-name + +revoked-style is one of: + grey - Print text in grey + hide - Don't show revoked uids + note - Add "(revoked)" + show - List revoked uids normally + strike - Strike through lines + +Output is PostScript which can be sent to e.g. the lpr command. + + +CREDITS +------- + +This script comes from the original Signing-Party package which has been +originally created and maintained by Simon Richter and +Thijs Kinkhorst . + + +COPYRIGHT & LICENSE +------------------- + +Copyright (C) 2001-2005 Simon Richter and Thijs Kinkhorst + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License with + the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; + if not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307 USA + + diff --git a/gpg-key2ps/gpg-key2ps b/gpg-key2ps/gpg-key2ps new file mode 100755 index 0000000..789d6d0 --- /dev/null +++ b/gpg-key2ps/gpg-key2ps @@ -0,0 +1,228 @@ +#! /bin/sh + +set -e + +VERSION="0.3.1" +USAGE="Usage: $0 [-p papersize] [-r revoked-style] keyid-or-name" + + +if [ -z "$*" ]; then + echo $USAGE + exit 1 +fi + +KEYIDS= +REVOKESTYLE=hide + +while [ -n "$1" ]; do + case "$1" in + -p) + PAPERSIZE=$2 + export PAPERSIZE + shift 2 + ;; + -p*) + PAPERSIZE=`echo $1 | sed -e 's/^-p//'` + export PAPERSIZE + shift 1 + ;; + -r) + REVOKESTYLE=$2 + shift 2 + ;; + -r*) + REVOKESTYLE=`echo $1 | sed -e 's/^-r//'` + shift 1 + ;; + -*) + echo $USAGE + exit 1 + ;; + *) + KEYIDS=$1 + shift 1 + ;; + esac +done + +case "$REVOKESTYLE" in +grey|hide|note|show|strike) + ;; +*) + echo >&2 "Unknown style \"$REVOKESTYLE\". Please use one of" + echo >&2 " grey - Print text in grey" + echo >&2 " hide - Don't show revoked uids" + echo >&2 " note - Add \"(revoked)\"" + echo >&2 " show - List revoked uids normally" + echo >&2 " strike - Strike through lines" + exit 1 + ;; +esac + +TMPFILE=`mktemp -t gpg-key2ps.XXXXXX` + +if ! gpg --fingerprint --with-colons $KEYIDS 2>/dev/null >$TMPFILE; then + echo >&2 "Key not found. Try 'gpg --list-keys'" + rm $TMPFILE + exit 1 +fi + +NUMLINES=$((`wc -l <$TMPFILE` + `grep '^pub:' $TMPFILE | wc -l` - 1)) + +if test -x /usr/bin/paperconf; then + w=`paperconf -w` + h=`paperconf -h` +else + # Default to A4. + w=596 + h=842 +fi + +cat <. diff --git a/gpg-mailkeys/README b/gpg-mailkeys/README new file mode 100644 index 0000000..ea49378 --- /dev/null +++ b/gpg-mailkeys/README @@ -0,0 +1,41 @@ +gpg-mailkeys +------------ + +Given one or more key-id's, gpg-mailkeys mails these keys to their owners. You +use this after you've signed them. By default, the mails contain a standard +text and your name and address as the From (as determined by the sendmail +command). + +You can modify how this script behaves by putting a .gpg-mailkeysrc file in +your homedir. An example of this file is provided with this document. + + +CREDITS +------- + +This script comes from the original Signing-Party package which has been +originally created and maintained by Simon Richter and +Thijs Kinkhorst . + + +COPYRIGHT & LICENSE +------------------- + +Copyright (C) 2001-2005 Simon Richter and Thijs Kinkhorst + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License with + the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; + if not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307 USA + + diff --git a/gpg-mailkeys/example.gpg-mailkeysrc b/gpg-mailkeys/example.gpg-mailkeysrc new file mode 100644 index 0000000..6a75b96 --- /dev/null +++ b/gpg-mailkeys/example.gpg-mailkeysrc @@ -0,0 +1,17 @@ +# ~/.gpg-mailkeysrc + +# Sender name +NAME="Your name here" + +# Sender address (don't use "<...>"!) +EMAIL="your.address@example.org" + +# Subject +SUBJECT="Your signed key" + +# Text to be included in the message body +TEXT=" +Hi, here you are: your signed key. + +See you! +" diff --git a/gpg-mailkeys/gpg-mailkeys b/gpg-mailkeys/gpg-mailkeys new file mode 100755 index 0000000..c065751 --- /dev/null +++ b/gpg-mailkeys/gpg-mailkeys @@ -0,0 +1,99 @@ +#! /bin/sh + +set -e + +VERSION="0.3.1" + +if [ -z "$*" ]; then + echo "Send people their newly signed GPG key by mail." + echo "Usage: $0 keyid ..." + exit 1 +fi + +if [ -e ~/.gpg-mailkeysrc ] ; then + . ~/.gpg-mailkeysrc +fi +if [ -n "$EMAIL" ]; then + FROM="$EMAIL" +fi +if [ -z "$SUBJECT" ]; then + SUBJECT="Your signed GPG key" +fi +if [ -z "$NAME" ]; then + NAME=`getent passwd $USER | cut -d: -f5 | cut -d, -f1` +fi +if [ -z "$TEXT" ]; then + TEXT="Hi, + +Here is your signed GPG key. + +Enjoy, +$NAME" +fi + +FAILKEYS= + +while [ -n "$1" ]; do + echo -n "[$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 + echo "(no usable user ids)" + FAILKEYS="$FAILKEYS:$1" + shift 1 + continue + fi + BOUNDARY="ksp-$$-boundary-$RANDOM" + + echo -n "$ADDR:" + if [ $FROM ]; then + echo >$TEMPFILE "From: $NAME <$FROM>" + fi +cat << EOM >> $TEMPFILE +To: $ADDR +Subject: $SUBJECT +User-Agent: gpg-mailkeys/$VERSION +MIME-Version: 1.0 +Content-Type: multipart/mixed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="$BOUNDARY" +Content-Disposition: inline + + + +--$BOUNDARY +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + + +$TEXT + +EOM + +if [ -f ~/.signature ]; + then echo "--=20" >> $TEMPFILE + cat ~/.signature >> $TEMPFILE +fi + +cat << EOM >> $TEMPFILE + +--$BOUNDARY +Content-Type: text/plain; charset=us-ascii +Content-Disposition: attachment; filename="$1.sig" + +`gpg --armor --export $1` + +--$BOUNDARY-- +EOM + echo -n " sending" + /usr/sbin/sendmail -t <$TEMPFILE + rm $TEMPFILE + echo " done." + shift 1 +done + +if [ -n "$FAILKEYS" ]; then + echo + echo "Note: The following keys could not be sent:" + echo "$FAILKEYS" | tr ':' '\n' | sed -e '/^ *$/d' -e 's/^/ /' +fi diff --git a/gpg-mailkeys/gpg-mailkeys.1 b/gpg-mailkeys/gpg-mailkeys.1 new file mode 100644 index 0000000..c8e5009 --- /dev/null +++ b/gpg-mailkeys/gpg-mailkeys.1 @@ -0,0 +1,21 @@ +.TH GPG-MAILKEYS 1 "February 15, 2003" +.SH NAME +gpg\-mailkeys \- sends emails containing keys to their owners +.SH SYNOPSIS +.B gpg-mailkeys +.RI id ... +.SH DESCRIPTION +.B gpg-mailkeys +sends the owners of the keys listed on the command line a mail each, +containing their public key. After signing, you can use this tool to send +everyone the new signatures they just got. +.SH OPTIONS +None +.SH ENVIRONMENT +.TP 13 +.I EMAIL +Set the email address to use when sending messages +.SH SEE ALSO +.BR gpg (1) +.SH AUTHOR +This manual page was written by Simon Richter . -- 2.30.2