diff options
author | Rob Austein <sra@hactrn.net> | 2006-08-22 22:27:08 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2006-08-22 22:27:08 +0000 |
commit | 9a4acdeded7f0373cb18881ca43695715f3d04a3 (patch) | |
tree | 7918e35f41f5890bab0894b1f778a59e20897a13 /scripts | |
parent | 5fc6881456fda481405469af99adc37dac0effe7 (diff) |
# on 2006/08/09 17:54:59, sra did:
Hack to generate table of g(aki), s(aki), filename for certificates
and CRLs.
svn path=/scripts/gki.pl; revision=183
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gki.pl | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/scripts/gki.pl b/scripts/gki.pl index 0b8f7d94..e91c4abe 100644 --- a/scripts/gki.pl +++ b/scripts/gki.pl @@ -1,12 +1,10 @@ : # $Id$ -eval 'exec perl -S $0 ${1+"$@"}' +eval 'exec perl -w -S $0 ${1+"$@"}' if 0; use MIME::Base64; -my $openssl = "/u/sra/isc/route-pki/subvert-rpki.hactrn.net/openssl/trunk/apps/openssl"; - sub g { my $x = shift; $x =~ s{:}{}g; @@ -18,19 +16,31 @@ sub g { } while (@ARGV) { - my $f = shift(@ARGV); - open(F, "-|", $openssl, qw(x509 -noout -inform DER -text -in), $f) - or die("Couldn't run openssl x509 on $f: $!\n"); + my ($file, $aki, $ski, $a, $s) = shift(@ARGV); + if ($file =~ /\.cer$/) { + open(F, "-|", qw(openssl x509 -noout -inform DER -text -in), $file) + or die("Couldn't run openssl x509 on $file: $!\n"); + } elsif ($file =~ /\.crl$/) { + open(F, "-|", qw(openssl crl -noout -inform DER -text -in), $file) + or die("Couldn't run openssl x509 on $file: $!\n"); + } else { + next; + } while (<F>) { chomp; - if (/X509v3 Authority Key Identifier:/) { - $aki = $. + 1; - } - if ($aki && $. == $aki) { - s/^[ \t]*keyid://; - $a = $_; - } + s/^\s*//; + s/^keyid://; + $a = $. + 1 + if (/X509v3 Authority Key Identifier:/); + $s = $. + 1 + if (/X509v3 Subject Key Identifier:/); + $aki = $_ + if ($a && $. == $a); + $ski = $_ + if ($s && $. == $s); } close(F); - print(g($a), " $f\n"); + my $gaki = $aki ? g($aki) : "=" x 27; + my $gski = $ski ? g($ski) : "=" x 27; + print("$gaki $gski $file\n"); } |