2000-07-17 16:32:21 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# ring-a-party - print a keyring suitable for a key signing party
|
2002-06-29 15:46:34 +02:00
|
|
|
# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# This file is free software; as a special exception the author gives
|
|
|
|
# unlimited permission to copy and/or distribute it, with or without
|
|
|
|
# modifications, as long as this notice is preserved.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2000-07-17 16:32:21 +02:00
|
|
|
|
|
|
|
if [ $# -lt 1 ]; then
|
|
|
|
echo "usage: ring-a-party keyring [headerline]" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
keyring="$1"
|
|
|
|
hdrline="$1"
|
|
|
|
if [ $# -gt 1 ]; then
|
|
|
|
hdrline="$2"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f $keyring ]; then
|
|
|
|
echo "ring-a-party: '$keyring': no such file" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "ring-a-party: output will be written to 'a.pub'" >&2
|
|
|
|
|
|
|
|
|
|
|
|
gpg --dry-run --with-fingerprint --with-colons $keyring \
|
|
|
|
| gawk -v "KEYRING=$hdrline" '
|
|
|
|
BEGIN { FS=":"
|
|
|
|
algos[1] = "RSA";
|
2004-07-04 23:17:29 +02:00
|
|
|
algos[16] = "Elgamal";
|
2000-07-17 16:32:21 +02:00
|
|
|
algos[17] = "DSA";
|
|
|
|
any = 0;
|
|
|
|
lines = -1;
|
|
|
|
page = 0;
|
|
|
|
now = strftime("%b %d %H:%M %Y");
|
|
|
|
}
|
2000-09-18 16:35:34 +02:00
|
|
|
END {
|
|
|
|
if (any) myflush();
|
|
|
|
}
|
2000-07-17 16:32:21 +02:00
|
|
|
$1 == "pub" {
|
|
|
|
if( any ) myflush();
|
|
|
|
uidcount = 0;
|
|
|
|
signencrypt = 0;
|
|
|
|
uids[uidcount++] = $10;
|
|
|
|
nbits = $3;
|
|
|
|
keyid = substr($5,9);
|
|
|
|
created = $6;
|
|
|
|
expires = $7;
|
|
|
|
algostr = mapalgo($4);
|
|
|
|
if( $4 == 20 || $4 == 1 ) signencrypt = 1;
|
|
|
|
any = 1;
|
|
|
|
}
|
|
|
|
$1 == "fpr" { fpr = $10 }
|
|
|
|
$1 == "uid" { uids[uidcount++] = $10 }
|
|
|
|
$1 == "sub" { if( $4 != 17 && $4 != 3 ) signencrypt=1 }
|
|
|
|
|
|
|
|
function myflush()
|
|
|
|
{
|
|
|
|
# fixme: take lines to print here into account
|
2002-06-29 15:46:34 +02:00
|
|
|
if( lines > 45 || lines == -1 ) {
|
2000-07-17 16:32:21 +02:00
|
|
|
if( lines != -1 ) printf "\f";
|
|
|
|
page++;
|
|
|
|
printf "%s %-50.50s Page %d\n\n", now, KEYRING, page ;
|
2002-06-29 15:46:34 +02:00
|
|
|
printf " Type Bits KeyID Created Expires Algorithm Use\n\n";
|
2000-07-17 16:32:21 +02:00
|
|
|
lines = 1;
|
|
|
|
}
|
2002-06-29 15:46:34 +02:00
|
|
|
printf "[ ] pub %04d 0x%s %10s %10s %-10s %15s\n",
|
2000-07-17 16:32:21 +02:00
|
|
|
nbits, keyid, created, expires == ""? "----------":expires, algostr,
|
|
|
|
signencrypt == 1? "Sign & Encrypt":"Sign only";
|
|
|
|
length(fpr) == 40 ? printfpr20( fpr ) : printfpr16( fpr );
|
|
|
|
lnes += 2;
|
|
|
|
for( i=0; i < uidcount; i++ ) {
|
2002-06-29 15:46:34 +02:00
|
|
|
printf "( ) uid %s\n", uids[i];
|
2000-07-17 16:32:21 +02:00
|
|
|
lines++;
|
|
|
|
}
|
|
|
|
printf "\n\n";
|
|
|
|
lines += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapalgo( no )
|
|
|
|
{
|
|
|
|
if( no in algos )
|
|
|
|
return algos[no];
|
|
|
|
return sprintf( "algoID=%ds", no );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function printfpr16( s )
|
|
|
|
{
|
2002-06-29 15:46:34 +02:00
|
|
|
printf " f16 Fingerprint16 =";
|
2000-07-17 16:32:21 +02:00
|
|
|
for(i=0; i < 16; i++ ) {
|
|
|
|
if( i == 8 ) printf " ";
|
2000-09-18 16:35:34 +02:00
|
|
|
printf " %s", substr( s, i*2+1, 2 );
|
2000-07-17 16:32:21 +02:00
|
|
|
}
|
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
function printfpr20( s )
|
|
|
|
{
|
2002-06-29 15:46:34 +02:00
|
|
|
printf " f20 Fingerprint20 =";
|
2000-07-17 16:32:21 +02:00
|
|
|
for(i=0; i < 10; i++ ) {
|
|
|
|
if( i == 5 ) printf " ";
|
2000-09-18 16:35:34 +02:00
|
|
|
printf " %s", substr( s, i*4+1, 4 );
|
2000-07-17 16:32:21 +02:00
|
|
|
}
|
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
' | tee a.pub | gpg --print-mds
|