$ca['crt'] = base64_encode($pconfig['cert']);
     if (!empty($pconfig['key'])) {
         $ca['prv'] = base64_encode($pconfig['key']);
     }
 } else {
     $old_err_level = error_reporting(0);
     /* otherwise openssl_ functions throw warnings directly to a page screwing menu tab */
     if ($pconfig['method'] == "existing") {
         ca_import($ca, $pconfig['cert'], $pconfig['key'], $pconfig['serial']);
     } else {
         if ($pconfig['method'] == "internal") {
             $dn = array('countryName' => $pconfig['dn_country'], 'stateOrProvinceName' => $pconfig['dn_state'], 'localityName' => $pconfig['dn_city'], 'organizationName' => $pconfig['dn_organization'], 'emailAddress' => $pconfig['dn_email'], 'commonName' => $pconfig['dn_commonname']);
             if (!empty($pconfig['dn_organizationalunit'])) {
                 $dn['organizationalUnitName'] = $pconfig['dn_organizationalunit'];
             }
             if (!ca_create($ca, $pconfig['keylen'], $pconfig['lifetime'], $dn, $pconfig['digest_alg'])) {
                 while ($ssl_err = openssl_error_string()) {
                     $input_errors = array();
                     array_push($input_errors, "openssl library returns: " . $ssl_err);
                 }
             }
         } else {
             if ($pconfig['method'] == "intermediate") {
                 $dn = array('countryName' => $pconfig['dn_country'], 'stateOrProvinceName' => $pconfig['dn_state'], 'localityName' => $pconfig['dn_city'], 'organizationName' => $pconfig['dn_organization'], 'emailAddress' => $pconfig['dn_email'], 'commonName' => $pconfig['dn_commonname']);
                 if (!empty($pconfig['dn_organizationalunit'])) {
                     $dn['organizationalUnitName'] = $pconfig['dn_organizationalunit'];
                 }
                 if (!ca_inter_create($ca, $pconfig['keylen'], $pconfig['lifetime'], $dn, $pconfig['caref'], $pconfig['digest_alg'])) {
                     while ($ssl_err = openssl_error_string()) {
                         $input_errors = array();
                         array_push($input_errors, "openssl library returns: " . $ssl_err);
Beispiel #2
0
     $ca['descr'] = $pconfig['descr'];
     $ca['refid'] = $pconfig['refid'];
     $ca['serial'] = $pconfig['serial'];
     $ca['crt'] = base64_encode($pconfig['cert']);
     if (!empty($pconfig['key'])) {
         $ca['prv'] = base64_encode($pconfig['key']);
     }
 } else {
     $old_err_level = error_reporting(0);
     /* otherwise openssl_ functions throw warings directly to a page screwing menu tab */
     if ($pconfig['method'] == "existing") {
         ca_import($ca, $pconfig['cert'], $pconfig['key'], $pconfig['serial']);
     } else {
         if ($pconfig['method'] == "internal") {
             $dn = array('countryName' => $pconfig['dn_country'], 'stateOrProvinceName' => $pconfig['dn_state'], 'localityName' => $pconfig['dn_city'], 'organizationName' => $pconfig['dn_organization'], 'emailAddress' => $pconfig['dn_email'], 'commonName' => $pconfig['dn_commonname']);
             if (!ca_create($ca, $pconfig['keylen'], $pconfig['lifetime'], $dn)) {
                 while ($ssl_err = openssl_error_string()) {
                     $input_errors = array();
                     array_push($input_errors, "openssl library returns: " . $ssl_err);
                 }
             }
         } else {
             if ($pconfig['method'] == "intermediate") {
                 $dn = array('countryName' => $pconfig['dn_country'], 'stateOrProvinceName' => $pconfig['dn_state'], 'localityName' => $pconfig['dn_city'], 'organizationName' => $pconfig['dn_organization'], 'emailAddress' => $pconfig['dn_email'], 'commonName' => $pconfig['dn_commonname']);
                 if (!ca_inter_create($ca, $pconfig['keylen'], $pconfig['lifetime'], $dn, $pconfig['caref'])) {
                     while ($ssl_err = openssl_error_string()) {
                         $input_errors = array();
                         array_push($input_errors, "openssl library returns: " . $ssl_err);
                     }
                 }
             }