diff options
author | Rob Austein <sra@hactrn.net> | 2006-09-18 19:27:58 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2006-09-18 19:27:58 +0000 |
commit | c0ccb4dc105078f09ddab79a4a29918dcf9dbcbb (patch) | |
tree | 4ddf93a0d9d256638143b85add2f827b14bb14af | |
parent | 8fdeac5d429c92c4f178b640ad1ff9479dcad3dd (diff) |
Support PEM as well as DER
svn path=/scripts/uri.pl; revision=284
-rw-r--r-- | scripts/uri.pl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/uri.pl b/scripts/uri.pl index 9b11f079..73389964 100644 --- a/scripts/uri.pl +++ b/scripts/uri.pl @@ -5,11 +5,22 @@ eval 'exec perl -w -S $0 ${1+"$@"}' use strict; +my $format = "DER"; + +while ($ARGV[0] =~ /^--/) { + $_ = shift; + if (/^--der/) { $format = "DER"; next } + if (/^--pem/) { $format = "PEM"; next } + if (/^--help/) { print("$0 [ --der | --pem ] cert [ cert ...]\n"); exit } + die("Unrecognized option: $_"); +} + while (@ARGV) { my $file = shift(@ARGV); my ($aia, $sia, $cdp, $a, $s, $c) = qw(- - -); next unless ($file =~ /\.cer$/); - open(F, "-|", qw(openssl x509 -noout -inform DER -text -in), $file) + open(F, "-|", ( qw(openssl x509 -noout -inform), $format, + qw(-text -in), $file)) or die("Couldn't run openssl x509 on $file: $!\n"); while (<F>) { chomp; |