1#!/usr/bin/perl
2# 2.4.1998, Sampo Kellomaki <sampo@iki.fi>
3#
4# Generate SSLeay certificate directory hashes for the gien files.
5#
6# Usage: cd ca/cert; ../../hash-certs.pl *.pem
7
8$ENV{'PATH'} .= ':/usr/local/ssl/bin';
9
10foreach $cert (@ARGV) {
11    $ext = ($cert =~ /\.pem$/i) ? 'pem' : 'der';
12    $hash = `openssl x509 -inform $ext -hash -noout <$cert`;
13    chomp $hash;
14    unlink $hash;
15    `ln -s $cert $hash.0`;
16    print "$cert --> $hash.0\n";
17}
18
19__END__
20