8ed2ca82a4c3378b3d72f7826873164b7cb8dd2a
3 # small script to show in an intuitive way who signed which of your user ids
5 # Copyright (c) 2004 Uli Martens <uli@youam.net>
6 # Copyright (c) 2005 Peter Palfrader <peter@palfrader.org>
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. The name of the author may not be used to endorse or promote products
18 # derived from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 open SIGS
, "gpg --fixed-list-mode --with-colons --list-sigs $key 2>/dev/null |"
40 or die "can't get gpg listing";
50 if ( m/^uid:.:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:(.*):$/ ) {
55 if ( m/^sig:[^:]*:[^:]*:[^:]*:([0-9A-F]*):[^:]*:[^:]*:[^:]*:[^:]*:(.*):[^:]*:$/ ) {
56 $2 eq "[User id not found]" ?
$unknownID{$1} = $1 : $ids{$2} = $1;
57 $sigs{$1}->{$uid} = "x" unless defined $sigs{$1}->{$uid};
60 if ( m/^rev:[^:]*:[^:]*:[^:]*:([0-9A-F]*):[^:]*:[^:]*:[^:]*:[^:]*:(.*):[^:]*:$/ ) {
61 $rev{$uid} = "x" if ($longkey eq $1);
62 $sigs{$1}->{$uid} = "R";
65 if ( m/^uat:.:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:(.*):$/ ) {
70 if ( m/^pub:[^:]*:[^:]*:[^:]*:([^:]*):[^:]*:[^:]*:[^:]*:[^:]*:(.*):$/ ) {
74 last if ( m/^(sub):/ );
75 next if ( m/^(tru):/ );
76 print STDERR
"hi, i'm a bug. please report me to my owner";
77 die "input: $_, key: $key";
81 # XXX: Add an option for this
83 @uids = grep { ! defined $rev{$uids[$c++]} } @uids;
85 my $n = scalar @uids -1;
86 for ( my $a=0; $a <= $n; $a++ ) {
90 . (defined $rev{$uids[$a]} ?
"R" : " ")
91 . "%2i $uids[$a]\n", $a+1;
94 for ( my $a=0; $a <= $n; $a++ ) {
99 for my $id (sort keys %ids) {
100 print((defined $sigs{$ids{$id}}->{$_} ?
$sigs{$ids{$id}}->{$_} : " ") . " ") for (@uids);
101 print $ids{$id}." $id\n";
103 for my $id (sort keys %unknownID) {
104 print((defined $sigs{$id}->{$_} ?
$sigs{$id}->{$_} : " ") . " ") for (@uids);
105 print "$id [User id not found]\n";