blob: 4b58a9d0181f35d31e341cdf8e5b491eeaca02c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# -*- Perl -*-
# $Id$
use strict;
my $openssl = "/u/sra/isc/route-pki/subvert-rpki.hactrn.net/openssl/openssl/apps/openssl";
my $dir = "hashed";
my @cmds;
my %hashes;
exit unless (@ARGV);
open(F, "-|", "find", @ARGV, qw{-type f ( -name *.cer -o -name *.crl )})
or die("Couldn't run find: $!\n");
@ARGV = ();
while (<F>) {
chomp;
my $f = $_;
my $type = /\.cer$/ ? "x509" : "crl";
$_ = "$dir/$f";
s=/[^/]+$==;
my $d = $_;
my $h = `$openssl $type -inform DER -in $f -noout -hash`;
chomp($h);
$h .= ".";
$h .= "r" if ($type eq "crl");
$h .= 0 + $hashes{$d}{$h}++;
push(@cmds, "$openssl $type -inform DER -outform PEM -out $d/$h -in $f\n");
}
close(F);
print("rm -rf $dir\n");
print("test -d $_ || mkdir -p $_\n")
foreach (sort(keys(%hashes)));
print($_)
foreach (@cmds);
|