#!/usr/bin/perl # sigtable.pl - visualisation of key signatures on multiple uids # # Copyright (C) 2003-2004, Daniel Roethlisberger # With contributions from Tobias Sager # All rights reserved. # # Redistribution and use, with or without modification, are permitted # provided that the following conditions are met: # 1. Redistributions must retain the above copyright notice, this list of # conditions and the following disclaimer. # 2. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # $Id: sigtable.pl,v 1.3 2004/02/18 16:05:57 roe Exp $ $mykey = shift() || $ENV{MYKEY} || die "Need MYKEY!\n"; open GPG, "gpg --list-sigs $mykey|"; my @uids; my %siguids; my %sigs; my $revoked = 0; while() { if(/^pub.* [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] (.*)/) { #pub 1024D/804A06B1 2002-07-04 Daniel Roethlisberger $uids[$#uids + 1] = $1; # print STDERR "uid: $1\n"; } elsif(/^uid +(.*)/) { #uid Daniel Roethlisberger my $uid = $1; if($uid =~ /^\[revoked\]/) { $revoked = 1; } else { $uids[$#uids + 1] = $uid; $revoked = 0; } # print STDERR "uid: $uid\n"; } elsif(/^sig.*([0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]) [0-9]+-[0-9]+-[0-9]+ +(.*)/) { #sig 2 R 690B13F9 2003-06-11 Matthias Kestenholz (private) my ($key,$uid) = ($1, $2); unless($revoked) { $sigs{$key}{$#uids} = 1; $siguids{$key} = $uid; } # print STDERR "sig $key $uid\n"; } elsif(/^sub/) { #sub 4096g/53D7E199 2002-07-04 # ignore $revoked = 0; } else { # ignore } } my $i; for($i = 0; $i <= $#uids; $i++) { print "|" x $i . $uids[$i] . "\n"; } print "|" x $i . "\n"; foreach(sort keys %siguids) { my $key = $_; my $s = ""; for(my $i = 0; $i <= $#uids; $i++) { if($sigs{$key}{$i}) { $s .= "x"; } else { $s .= " "; } } print $s . " " . $key . " " . $siguids{$key} . "\n"; }