% layout 'default'; % title 'Lookup';
<% my %sigcls = ( '0x10' => 'self sig', '0x11' => 'self sig', '0x12' => 'self sig', '0x13' => 'self sig', '0x18' => 'subkey bind', '0x19' => 'primary key bind', '0x20' => 'revocation sig', '0x28' => 'subkey revocation sig', '0x30' => 'cert revocation sig', '0x1F' => 'direct key sig', ); my $PubKeyAlgos = PubKeyAlgos->new(); my $algo_and_bits = ''; for my $row (@row) { my @data = split /:/, $row; my $record = $data[0]; my $flag = $data[1]; my $keylen = $data[2]; my $algo = $data[3]; my $keyid = $data[4]; my $create = $data[5]; my $expire = $data[6]; my $version = $data[7]; # jjakke edition my $userid = $data[9]; my $signatureclass = $data[10]; my $key_issuer = $data[12]; # jjakke edition if ($flag and ($flag eq 'e' or $flag eq 'r')) { $flag = "$flag" } if ($record eq 'pub') { no warnings qw(uninitialized numeric); # when debugging, comment this out. $algo_and_bits = $PubKeyAlgos->valid($algo)->[0] . "/$keylen"; if ($expire) { $string .= "public key: " . gmtime($create) . " -> " . gmtime($expire) . " | flags: $flag | v:$version\n"; } else { $string .= "public key: " . gmtime($create) . " -> n/a" . " | flags: $flag | v:$version\n"; } } elsif ($record eq 'fpr') { $algo_and_bits =~ s/\s+(\(.*\))//; $algo_and_bits =~ s/\s?public key algorithm\s*//; if (not $pubkey_fpr) { $string .= "fingerprint: $userid | $algo_and_bits\n"; $pubkey_fpr = 1; } else { $string .= "fingerprint: $userid | $algo_and_bits\n"; } $algo_and_bits = ''; } elsif ($record eq 'uid') { my $safe = Encode::decode_utf8($userid); $safe =~ s/>/>/g if $safe; $safe =~ s/</g if $safe; $string .= "\n$safe\n" if $safe; } elsif ($record eq 'sig') { no warnings qw(uninitialized numeric); # when debugging, comment this out. $string .= "signature: "; # V6 keys 'MUST NOT' create keyids. However, they do have key issuer, which I will create a keyid from (high bits, not low bits like with V4) . if ($keyid) { $string .= $keyid } elsif ($key_issuer) { $string .= substr($key_issuer,0,16) . "[trun]"; } if ($expire and (int $expire)) { $string .= " | " . gmtime($create) . " -> ". gmtime($expire) . " | "; } else { $string .= " | " . gmtime($create) . " -> n/a" . " | "; } (exists $sigcls{$signatureclass}) ? ($string .= $sigcls{$signatureclass}) : ($string .= $signatureclass); $string .= "\n"; } elsif ($record eq 'sub') { no warnings qw(uninitialized numeric); # when debugging, comment this out. $algo_and_bits = $PubKeyAlgos->valid($algo)->[0] . "/$keylen"; if ($expire) { if (time > $expire) { $string .= "\nsub key: " . gmtime($create) . " -> " . ( $expire ? gmtime($expire) : 'n/a' ) . " | flags: $flag\n" } else { $string .= "\nsub key: " . gmtime($create) . " -> " . ( $expire ? gmtime($expire) : 'n/a' ) . " | flags: $flag\n" } } else { $string .= "\nsub key: " . gmtime($create) . " -> " . ( $expire ? gmtime($expire) : 'n/a' ) . " | flags: $flag\n" } } elsif ($record eq 'rev') { no warnings qw(uninitialized numeric); # when debugging, comment this out. $string .= "revocation: $keyid | " . gmtime($create) . " | "; (exists $sigcls{$signatureclass}) ? ($string .= $sigcls{$signatureclass}) : ($string .= $signatureclass); $string .= "\n"; } } %> %== $string<% } #rev:::1:95660BB822BAC934:1388248001:::::[selfsig]::20x: #pub:u:255:22:9904E01052985080:1730221618:1856365618::u:,4 #fpr:::::::::50B750CC829A462D016AD9679904E01052985080: #uid:::::::::Jake Thoughts (jjakke)