当前位置: 首页>>代码示例>>PHP>>正文


PHP cert_create函数代码示例

本文整理汇总了PHP中cert_create函数的典型用法代码示例。如果您正苦于以下问题:PHP cert_create函数的具体用法?PHP cert_create怎么用?PHP cert_create使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cert_create函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: error_reporting

 $cert['descr'] = $pconfig['descr'];
 $old_err_level = error_reporting(0);
 /* otherwise openssl_ functions throw warings directly to a page screwing menu tab */
 if ($pconfig['certmethod'] == "import") {
     cert_import($cert, $pconfig['cert'], $pconfig['key']);
 }
 if ($pconfig['certmethod'] == "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 (count($altnames)) {
         $altnames_tmp = "";
         foreach ($altnames as $altname) {
             $altnames_tmp[] = "{$altname['type']}:{$altname['value']}";
         }
         $dn['subjectAltName'] = implode(",", $altnames_tmp);
     }
     if (!cert_create($cert, $pconfig['caref'], $pconfig['keylen'], $pconfig['lifetime'], $dn, $pconfig['digest_alg'], $pconfig['cert_type'])) {
         $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);
     }
开发者ID:paudam,项目名称:opnsense-core,代码行数:31,代码来源:system_certmanager.php

示例2: elseif

 if (!empty($pconfig['disabled'])) {
     $userent['disabled'] = true;
 } elseif (isset($userent['disabled'])) {
     unset($userent['disabled']);
 }
 if (isset($id)) {
     $a_user[$id] = $userent;
 } else {
     if (!empty($pconfig['name'])) {
         $cert = array();
         $cert['refid'] = uniqid();
         $userent['cert'] = array();
         $cert['descr'] = $pconfig['name'];
         $subject = cert_get_subject_array($ca['crt']);
         $dn = array('countryName' => $subject[0]['v'], 'stateOrProvinceName' => $subject[1]['v'], 'localityName' => $subject[2]['v'], 'organizationName' => $subject[3]['v'], 'emailAddress' => $subject[4]['v'], 'commonName' => $userent['name']);
         cert_create($cert, $pconfig['caref'], $pconfig['keylen'], (int) $pconfig['lifetime'], $dn);
         if (!is_array($config['cert'])) {
             $config['cert'] = array();
         }
         $config['cert'][] = $cert;
         $userent['cert'][] = $cert['refid'];
     }
     $userent['uid'] = $config['system']['nextuid']++;
     /* Add the user to All Users group. */
     foreach ($config['system']['group'] as $gidx => $group) {
         if ($group['name'] == "all") {
             if (!is_array($config['system']['group'][$gidx]['member'])) {
                 $config['system']['group'][$gidx]['member'] = array();
             }
             $config['system']['group'][$gidx]['member'][] = $userent['uid'];
             break;
开发者ID:noikiy,项目名称:core-2,代码行数:31,代码来源:system_usermanager.php

示例3: unset

 if ($_POST['disabled']) {
     $userent['disabled'] = true;
 } else {
     unset($userent['disabled']);
 }
 if (isset($id) && $a_user[$id]) {
     $a_user[$id] = $userent;
 } else {
     if (!empty($_POST['name'])) {
         $cert = array();
         $cert['refid'] = uniqid();
         $userent['cert'] = array();
         $cert['descr'] = $_POST['name'];
         $subject = cert_get_subject_array($ca['crt']);
         $dn = array('countryName' => $subject[0]['v'], 'stateOrProvinceName' => $subject[1]['v'], 'localityName' => $subject[2]['v'], 'organizationName' => $subject[3]['v'], 'emailAddress' => $subject[4]['v'], 'commonName' => $userent['name']);
         cert_create($cert, $_POST['caref'], $_POST['keylen'], (int) $_POST['lifetime'], $dn);
         if (!is_array($config['cert'])) {
             $config['cert'] = array();
         }
         $config['cert'][] = $cert;
         $userent['cert'][] = $cert['refid'];
     }
     $userent['uid'] = $config['system']['nextuid']++;
     /* Add the user to All Users group. */
     foreach ($config['system']['group'] as $gidx => $group) {
         if ($group['name'] == "all") {
             if (!is_array($config['system']['group'][$gidx]['member'])) {
                 $config['system']['group'][$gidx]['member'] = array();
             }
             $config['system']['group'][$gidx]['member'][] = $userent['uid'];
             break;
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:system_usermanager.php

示例4: array

     }
 } else {
     $cert = array();
     $cert['refid'] = uniqid();
     if (isset($id) && $a_cert[$id]) {
         $cert = $a_cert[$id];
     }
     $cert['descr'] = $pconfig['descr'];
     $old_err_level = error_reporting(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);
             }
         }
     }
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:system_certmanager.php


注:本文中的cert_create函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。