function ca_import(&$ca, $str, $key = "", $serial = 0) { global $config; $ca['crt'] = base64_encode($str); if (!empty($key)) { $ca['prv'] = base64_encode($key); } if (!empty($serial)) { $ca['serial'] = $serial; } $subject = cert_get_subject($str, false); $issuer = cert_get_issuer($str, false); // Find my issuer unless self-signed if ($issuer != $subject) { $issuer_crt =& lookup_ca_by_subject($issuer); if ($issuer_crt) { $ca['caref'] = $issuer_crt['refid']; } } /* Correct if child certificate was loaded first */ if (is_array($config['ca'])) { foreach ($config['ca'] as &$oca) { $issuer = cert_get_issuer($oca['crt']); if ($ca['refid'] != $oca['refid'] && $issuer == $subject) { $oca['caref'] = $ca['refid']; } } } if (is_array($config['cert'])) { foreach ($config['cert'] as &$cert) { $issuer = cert_get_issuer($cert['crt']); if ($issuer == $subject) { $cert['caref'] = $ca['refid']; } } } return true; }
</th> <th><?php echo gettext("Distinguished Name"); ?> </th> <th><?php echo gettext("Actions"); ?> </th> </tr> </thead> <tbody> <?php foreach ($a_ca as $i => $ca) { $name = htmlspecialchars($ca['descr']); $subj = cert_get_subject($ca['crt']); $issuer = cert_get_issuer($ca['crt']); list($startdate, $enddate) = cert_get_dates($ca['crt']); if ($subj == $issuer) { $issuer_name = gettext("self-signed"); } else { $issuer_name = gettext("external"); } $subj = htmlspecialchars($subj); $issuer = htmlspecialchars($issuer); $certcount = 0; $issuer_ca = lookup_ca($ca['caref']); if ($issuer_ca) { $issuer_name = $issuer_ca['descr']; } foreach ($a_cert as $cert) {