use strict;
use POSIX qw(strftime);
# Version: 1.1
# Date: 2001.01.07
# Revised: 2004.04.06
# Author: V. Alex Brennen <vab@cryptnet.net>
# http://www.cryptnet.net/people/vab/
# Author: Gerfried Fuchs <alfie@ist.org>
# http://alfie.ist.org/alfie/
# License: Public Domain
# Description:
# This script was written as part of the gpg keysigning
# party howto. It generates a checklist for individuals
# participating in a keysigning party. The keysigning
# howto lives at:
# http://www.cryptnet.net/fdp/crypto/gpg-party.html
unless($ARGV[0])
{
print "\nUsage: party-table.pl <keyring> > out_file.html\n";
print "\nThe keyring should be the keyring where the public keys for the\n";
print "party participants are stored.\n\n";
exit;
}
my @fps = `gpg --fingerprint --no-default-keyring --no-options --with-colons --keyring $ARGV[0] | egrep '^(pub|fpr):'`;
print <<EOF;
\\documentclass[10pt]{article}
\\usepackage[landscape,margin=0.25in]{geometry}
\\usepackage{longtable}
\\begin{document}
\\begin{longtable}{|c|c|c|c|c|c|c|c|}
\\hline
& & & & & \\textbf{Expiration} & \\textbf{Info} & \\textbf{Owner} \\\\
\\textbf{Key ID} & \\textbf{Owner} & \\textbf{Fingerprint} & \\textbf{Size} & \\textbf{Type} & \\textbf{Date} & \\textbf{Match} & \\textbf{Match} \\\\
\\hline\\hline\\endhead
\\hline\\hline
& & & & & \\textbf{Expiration} & \\textbf{Info} & \\textbf{Owner} \\\\
\\textbf{Key ID} & \\textbf{Owner} & \\textbf{Fingerprint} & \\textbf{Size} & \\textbf{Type} & \\textbf{Date} & \\textbf{Match} & \\textbf{Match} \\\\
\\hline\\endfoot
EOF
while(my $line = shift(@fps)) {
if($line =~ /^pub/) {
my ($pub,$comptrust,$size,$type,$longid,$date,$expr,
undef,$settrust,$owner,undef,undef,$flags,undef)
= split /:/, $line;
my $id = substr($longid, 8);
my ($fpr,undef,undef,undef,undef,undef,undef,undef,undef,$fingerprint)
= split /:/, shift(@fps);
my ($upperFP, $lowerFP);
if($type eq '17') {
$type = 'DSA';
}
elsif($type eq '20') {
$type = 'El Gamal';
}
elsif($type eq '1') {
$type = 'RSA';
}
if(length($fingerprint) == 40) {
for my $i (36,32,28,24,20,16,12,8,4) {
substr($fingerprint,$i,0,' ');
}
$upperFP = substr($fingerprint,0,24);
$lowerFP = substr($fingerprint,25);
}
elsif (length($fingerprint) == 32) {
for my $i (30,28,26,24,22,20,18,16,14,12,10,8,6,4,2) {
substr($fingerprint,$i,0,' ');
}
$upperFP = substr($fingerprint,0,23);
$lowerFP = substr($fingerprint,24);
}
$owner =~ s/&/\\&/;
$owner =~ s/</\$<\$/;
$owner =~ s/>/\$>\$/;
print <<EOF;
\\texttt{$id} & $owner & \\texttt{$upperFP} & $size & $type & $expr & & \\\\
& & \\texttt{$lowerFP} & & & & & \\\\
\\hline
EOF
}
}
print <<EOF;
\\end{longtable}
\\end{document}
EOF