X-Git-Url: http://git.rot13.org/?p=bcm963xx.git;a=blobdiff_plain;f=userapps%2Fopensource%2Fopenssl%2Fapps%2FCA.pl;h=4f3ba0f08c78d37bfddb95474ee88c663c661276;hp=669a016b8432ca5685966eb6ba7b8ef189e98537;hb=864458111a0e69d94bbae210d5b7349ca072a6b7;hpb=a69849c98808437716b821267cd97529c56f45b0 diff --git a/userapps/opensource/openssl/apps/CA.pl b/userapps/opensource/openssl/apps/CA.pl index 669a016b..4f3ba0f0 100755 --- a/userapps/opensource/openssl/apps/CA.pl +++ b/userapps/opensource/openssl/apps/CA.pl @@ -36,13 +36,21 @@ # default openssl.cnf file has setup as per the following # demoCA ... where everything is stored +my $openssl; +if(defined $ENV{OPENSSL}) { + $openssl = $ENV{OPENSSL}; +} else { + $openssl = "openssl"; + $ENV{OPENSSL} = $openssl; +} + $SSLEAY_CONFIG=$ENV{"SSLEAY_CONFIG"}; $DAYS="-days 365"; -$REQ="openssl req $SSLEAY_CONFIG"; -$CA="openssl ca $SSLEAY_CONFIG"; -$VERIFY="openssl verify"; -$X509="openssl x509"; -$PKCS12="openssl pkcs12"; +$REQ="$openssl req $SSLEAY_CONFIG"; +$CA="$openssl ca $SSLEAY_CONFIG"; +$VERIFY="$openssl verify"; +$X509="$openssl x509"; +$PKCS12="$openssl pkcs12"; $CATOP="./demoCA"; $CAKEY="cakey.pem"; @@ -82,9 +90,6 @@ foreach (@ARGV) { mkdir "${CATOP}/crl", $DIRMODE ; mkdir "${CATOP}/newcerts", $DIRMODE; mkdir "${CATOP}/private", $DIRMODE; - open OUT, ">${CATOP}/serial"; - print OUT "01\n"; - close OUT; open OUT, ">${CATOP}/index.txt"; close OUT; } @@ -106,6 +111,10 @@ foreach (@ARGV) { $RET=$?; } } + if (! -f "${CATOP}/serial" ) { + system ("$X509 -in ${CATOP}/$CACERT -noout " + . "-next_serial -out ${CATOP}/serial"); + } } elsif (/^-pkcs12$/) { my $cname = $ARGV[1]; $cname = "My Certificate" unless defined $cname;