本文整理汇总了PHP中cert_get_purpose函数的典型用法代码示例。如果您正苦于以下问题:PHP cert_get_purpose函数的具体用法?PHP cert_get_purpose怎么用?PHP cert_get_purpose使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cert_get_purpose函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gettext
<th><?php
echo gettext("In Use");
?>
</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($a_cert as $cert) {
$name = htmlspecialchars($cert['descr']);
$purpose = null;
if (!empty($cert['crt'])) {
$subj = cert_get_subject($cert['crt']);
$issuer = cert_get_issuer($cert['crt']);
$purpose = cert_get_purpose($cert['crt']);
list($startdate, $enddate) = cert_get_dates($cert['crt']);
if ($subj == $issuer) {
$caname = "<em>" . gettext("self-signed") . "</em>";
} else {
$caname = "<em>" . gettext("external") . "</em>";
}
$subj = htmlspecialchars($subj);
}
if (isset($cert['csr'])) {
$subj = htmlspecialchars(csr_get_subject($cert['csr']));
$caname = "<em>" . gettext("external - signature pending") . "</em>";
}
if (isset($cert['caref'])) {
$ca = lookup_ca($cert['caref']);
if ($ca) {
示例2: Form_Select
$list[$ca['refid']] = $ca['descr'];
}
$section->addInput(new Form_Select('caref', 'Peer Certificate Authority', $pconfig['caref'], $list));
} else {
$section->addInput(new Form_StaticText('Peer Certificate Authority', sprintf('No Certificate Authorities defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>')));
}
if (count($a_crl)) {
$section->addInput(new Form_Select('crlref', 'Peer Certificate Revocation list', $pconfig['crlref'], openvpn_build_crl_list()));
} else {
$section->addInput(new Form_StaticText('Peer Certificate Revocation list', sprintf('No Certificate Revocation Lists defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>')));
}
$certhelp = '<span id="certtype"></span>';
if (count($a_cert)) {
if (!empty(trim($pconfig['certref']))) {
$thiscert = lookup_cert($pconfig['certref']);
$purpose = cert_get_purpose($thiscert['crt'], true);
if ($purpose['server'] != "Yes") {
$certhelp = '<span id="certtype" class="text-danger">' . gettext("Warning: The selected server certificate was not created as an SSL Server certificate and may not work as expected") . ' </span>';
}
}
} else {
$certhelp = sprintf('%s%s%s$s', '<span id="certtype">', gettext('No Certificates defined. You may create one here: '), '<a href="system_camanager.php">' . gettext("System > Cert Manager") . '</a>', '</span>');
}
$cl = openvpn_build_cert_list(false, true);
//Save the number of server certs for use at run-time
$servercerts = count($cl['server']);
$section->addInput(new Form_Select('certref', 'Server certificate', $pconfig['certref'], $cl['server'] + $cl['non-server']))->setHelp($certhelp);
$section->addInput(new Form_Select('dh_length', 'DH Parameter length (bits)', $pconfig['dh_length'], array_combine($openvpn_dh_lengths, $openvpn_dh_lengths)))->setHelp(count($a_cert) ? '' : sprintf('No Certificates defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'));
if (!$pconfig['shared_key']) {
$section->addInput(new Form_Checkbox('autokey_enable', 'Shared key', 'Automatically generate a shared key', $pconfig['autokey_enable']));
}