コード例 #1
0
         $input_errors = array();
         while ($ssl_err = openssl_error_string()) {
             $input_errors[] = gettext("openssl library returns:") . " " . $ssl_err;
         }
     }
 }
 if ($pconfig['certmethod'] == "external") {
     $dn = array('countryName' => $pconfig['csr_dn_country'], 'stateOrProvinceName' => $pconfig['csr_dn_state'], 'localityName' => $pconfig['csr_dn_city'], 'organizationName' => $pconfig['csr_dn_organization'], 'emailAddress' => $pconfig['csr_dn_email'], 'commonName' => $pconfig['csr_dn_commonname']);
     if (count($altnames)) {
         $altnames_tmp = "";
         foreach ($altnames as $altname) {
             $altnames_tmp[] = "{$altname['type']}:{$altname['value']}";
         }
         $dn['subjectAltName'] = implode(",", $altnames_tmp);
     }
     if (!csr_generate($cert, $pconfig['csr_keylen'], $dn, $pconfig['csr_digest_alg'])) {
         $input_errors = array();
         while ($ssl_err = openssl_error_string()) {
             $input_errors[] = gettext("openssl library returns:") . " " . $ssl_err;
         }
     }
 }
 error_reporting($old_err_level);
 if (isset($id)) {
     $a_cert[$id] = $cert;
 } else {
     $a_cert[] = $cert;
 }
 if (isset($a_user) && isset($userid)) {
     $a_user[$userid]['cert'][] = $cert['refid'];
 }
コード例 #2
0
 /* otherwise openssl_ functions throw warings directly to a page screwing menu tab */
 if ($pconfig['method'] == "import") {
     cert_import($cert, $pconfig['cert'], $pconfig['key']);
 }
 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 (!cert_create($cert, $pconfig['caref'], $pconfig['keylen'], $pconfig['lifetime'], $dn, $pconfig['type'])) {
         while ($ssl_err = openssl_error_string()) {
             $input_errors = array();
             array_push($input_errors, "openssl library returns: " . $ssl_err);
         }
     }
 }
 if ($pconfig['method'] == "external") {
     $dn = array('countryName' => $pconfig['csr_dn_country'], 'stateOrProvinceName' => $pconfig['csr_dn_state'], 'localityName' => $pconfig['csr_dn_city'], 'organizationName' => $pconfig['csr_dn_organization'], 'emailAddress' => $pconfig['csr_dn_email'], 'commonName' => $pconfig['csr_dn_commonname']);
     if (!csr_generate($cert, $pconfig['csr_keylen'], $dn)) {
         while ($ssl_err = openssl_error_string()) {
             $input_errors = array();
             array_push($input_errors, "openssl library returns: " . $ssl_err);
         }
     }
 }
 error_reporting($old_err_level);
 if (isset($id) && $a_cert[$id]) {
     $a_cert[$id] = $cert;
 } else {
     $a_cert[] = $cert;
 }
 if (isset($a_user) && isset($userid)) {
     $a_user[$userid]['cert'][] = $cert['refid'];
 }