From c0ccb4dc105078f09ddab79a4a29918dcf9dbcbb Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 18 Sep 2006 19:27:58 +0000 Subject: Support PEM as well as DER svn path=/scripts/uri.pl; revision=284 --- scripts/uri.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 () { chomp; -- cgit v1.2.3