* Import keyanalyze into signing-party. Thanks to Matthew Wilcox for the
[pgp-tools.git] / keyanalyze / willy / cosign
1 #!/usr/bin/perl
2
3 for (@ARGV) {
4 open(KEY, $_);
5 ($name = $_) =~ s#.*/##;
6
7 $state = 0;
8 $#to = -1;
9 $#from = -1;
10 $#onlyto = -1;
11 while ($line = <KEY>) {
12 if ($line =~ "^Signatures to") {
13 $state = 1;
14 } elsif ($line =~ "^Total:") {
15 $state = 0;
16 } elsif ($line =~ "^Signatures from") {
17 $state = 2;
18 } elsif ($state == 1) {
19 $to[++$#to] = $line;
20 } elsif ($state == 2) {
21 $from[++$#from] = $line;
22 }
23 }
24 close(KEY);
25
26 @to = sort @to;
27 @from = sort @from;
28
29 TO: foreach $sigto (@to) {
30 foreach $index (0 .. @from) {
31 if ($sigto eq $from[$index]) {
32 splice(@from, $index, 1);
33 next TO;
34 }
35 }
36 $onlyto[++$#onlyto] = $sigto;
37 }
38
39 $signed = $#onlyto + 1;
40 $signedby = $#from + 1;
41
42 print "The following $signedby keys have not signed key $name:\n";
43 print @from;
44 print " \nKey $name has not signed $signed keys:\n";
45 print @onlyto;
46 print "\n";
47 }