2 # ring-a-party - print a keyring suitable for a key signing party
3 # Copyright (C) 2000, 2001 Free Software Foundation, Inc.
5 # This file is free software; as a special exception the author gives
6 # unlimited permission to copy and/or distribute it, with or without
7 # modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 echo "usage: ring-a-party keyring [headerline]" >&2
24 if [ ! -f $keyring ]; then
25 echo "ring-a-party: '$keyring': no such file" >&2
29 echo "ring-a-party: output will be written to 'a.pub'" >&2
32 gpg --dry-run --with-fingerprint --with-colons $keyring \
33 | gawk -v "KEYRING=$hdrline" '
36 algos[16] = "ElGamal";
41 now = strftime("%b %d %H:%M %Y");
50 uids[uidcount++] = $10;
55 algostr = mapalgo($4);
56 if( $4 == 20 || $4 == 1 ) signencrypt = 1;
59 $1 == "fpr" { fpr = $10 }
60 $1 == "uid" { uids[uidcount++] = $10 }
61 $1 == "sub" { if( $4 != 17 && $4 != 3 ) signencrypt=1 }
65 # fixme: take lines to print here into account
66 if( lines > 45 || lines == -1 ) {
67 if( lines != -1 ) printf "\f";
69 printf "%s %-50.50s Page %d\n\n", now, KEYRING, page ;
70 printf " Type Bits KeyID Created Expires Algorithm Use\n\n";
73 printf "[ ] pub %04d 0x%s %10s %10s %-10s %15s\n",
74 nbits, keyid, created, expires == ""? "----------":expires, algostr,
75 signencrypt == 1? "Sign & Encrypt":"Sign only";
76 length(fpr) == 40 ? printfpr20( fpr ) : printfpr16( fpr );
78 for( i=0; i < uidcount; i++ ) {
79 printf "( ) uid %s\n", uids[i];
86 function mapalgo( no )
90 return sprintf( "algoID=%ds", no );
94 function printfpr16( s )
96 printf " f16 Fingerprint16 =";
97 for(i=0; i < 16; i++ ) {
98 if( i == 8 ) printf " ";
99 printf " %s", substr( s, i*2+1, 2 );
104 function printfpr20( s )
106 printf " f20 Fingerprint20 =";
107 for(i=0; i < 10; i++ ) {
108 if( i == 5 ) printf " ";
109 printf " %s", substr( s, i*4+1, 4 );
114 ' | tee a.pub | gpg --print-mds