CA.pl.in (109998) | CA.pl.in (142425) |
---|---|
1#!/usr/local/bin/perl 2# 3# CA - wrapper around ca to make it easier to use ... basically ca requires 4# some setup stuff to be done before you can use it and this makes 5# things easier between now and when Eric is convinced to fix it :-) 6# 7# CA -newca ... will setup the right stuff 8# CA -newreq[-nodes] ... will generate a certificate request --- 68 unchanged lines hidden (view full) --- 77 $NEW="1"; 78 if ( "$NEW" || ! -f "${CATOP}/serial" ) { 79 # create the directory hierarchy 80 mkdir $CATOP, $DIRMODE; 81 mkdir "${CATOP}/certs", $DIRMODE; 82 mkdir "${CATOP}/crl", $DIRMODE ; 83 mkdir "${CATOP}/newcerts", $DIRMODE; 84 mkdir "${CATOP}/private", $DIRMODE; | 1#!/usr/local/bin/perl 2# 3# CA - wrapper around ca to make it easier to use ... basically ca requires 4# some setup stuff to be done before you can use it and this makes 5# things easier between now and when Eric is convinced to fix it :-) 6# 7# CA -newca ... will setup the right stuff 8# CA -newreq[-nodes] ... will generate a certificate request --- 68 unchanged lines hidden (view full) --- 77 $NEW="1"; 78 if ( "$NEW" || ! -f "${CATOP}/serial" ) { 79 # create the directory hierarchy 80 mkdir $CATOP, $DIRMODE; 81 mkdir "${CATOP}/certs", $DIRMODE; 82 mkdir "${CATOP}/crl", $DIRMODE ; 83 mkdir "${CATOP}/newcerts", $DIRMODE; 84 mkdir "${CATOP}/private", $DIRMODE; |
85 open OUT, ">${CATOP}/serial"; 86 print OUT "01\n"; 87 close OUT; | |
88 open OUT, ">${CATOP}/index.txt"; 89 close OUT; 90 } 91 if ( ! -f "${CATOP}/private/$CAKEY" ) { 92 print "CA certificate filename (or enter to create)\n"; 93 $FILE = <STDIN>; 94 95 chop $FILE; --- 5 unchanged lines hidden (view full) --- 101 $RET=$?; 102 } else { 103 print "Making CA certificate ...\n"; 104 system ("$REQ -new -x509 -keyout " . 105 "${CATOP}/private/$CAKEY -out ${CATOP}/$CACERT $DAYS"); 106 $RET=$?; 107 } 108 } | 85 open OUT, ">${CATOP}/index.txt"; 86 close OUT; 87 } 88 if ( ! -f "${CATOP}/private/$CAKEY" ) { 89 print "CA certificate filename (or enter to create)\n"; 90 $FILE = <STDIN>; 91 92 chop $FILE; --- 5 unchanged lines hidden (view full) --- 98 $RET=$?; 99 } else { 100 print "Making CA certificate ...\n"; 101 system ("$REQ -new -x509 -keyout " . 102 "${CATOP}/private/$CAKEY -out ${CATOP}/$CACERT $DAYS"); 103 $RET=$?; 104 } 105 } |
106 if (! -f "${CATOP}/serial" ) { 107 system ("$X509 -in ${CATOP}/$CACERT -noout " 108 . "-next_serial -out ${CATOP}/serial"); 109 } |
|
109 } elsif (/^-pkcs12$/) { 110 my $cname = $ARGV[1]; 111 $cname = "My Certificate" unless defined $cname; 112 system ("$PKCS12 -in newcert.pem -inkey newreq.pem " . 113 "-certfile ${CATOP}/$CACERT -out newcert.p12 " . 114 "-export -name \"$cname\""); 115 $RET=$?; 116 exit $RET; --- 57 unchanged lines hidden --- | 110 } elsif (/^-pkcs12$/) { 111 my $cname = $ARGV[1]; 112 $cname = "My Certificate" unless defined $cname; 113 system ("$PKCS12 -in newcert.pem -inkey newreq.pem " . 114 "-certfile ${CATOP}/$CACERT -out newcert.p12 " . 115 "-export -name \"$cname\""); 116 $RET=$?; 117 exit $RET; --- 57 unchanged lines hidden --- |