mirror of
https://salsa.debian.org/debian-keyring/keyring.git
synced 2026-01-16 23:12:26 +00:00
52 lines
857 B
Perl
Executable file
52 lines
857 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use DB_File;
|
|
|
|
my %ident;
|
|
|
|
if ($#ARGV != 0 and $#ARGV != 1) {
|
|
print "Must supply key id.\n";
|
|
exit 1;
|
|
}
|
|
|
|
open KEYIDS, "<keyids" or die "Can't open keyids file: $!";
|
|
while (<KEYIDS>) {
|
|
chomp;
|
|
/^0x([^ ]*) (.*)/;
|
|
$ident{$1} = $2;
|
|
}
|
|
close KEYIDS;
|
|
|
|
$ARGV[0] =~ s/0x//;
|
|
|
|
my $keyid = $ARGV[0];
|
|
my $user;
|
|
if (! defined($ident{$ARGV[0]})) {
|
|
if ($#ARGV == 1) {
|
|
$user = $ARGV[1] . " [DM]";
|
|
} else {
|
|
$user = "UNKNOWN (DM?)";
|
|
}
|
|
} else {
|
|
$user = $ident{$ARGV[0]};
|
|
}
|
|
|
|
my ($uids, $subs, $sigs) = (0, 0, 0);
|
|
while (<STDIN>) {
|
|
if (/new subkeys: (\d+)$/) {
|
|
$subs = $1;
|
|
} elsif (/new user IDs: (\d+)$/) {
|
|
$uids = $1;
|
|
} elsif (/new signatures: (\d+)$/) {
|
|
$sigs = $1;
|
|
}
|
|
}
|
|
|
|
print "0x$keyid $user";
|
|
print " uid:$uids" if ($uids > 0);
|
|
print " sub:$subs" if ($subs > 0);
|
|
print " sig:$sigs" if ($sigs > 0);
|
|
print "\n";
|