include "../config.php"; include STORE_DIR . '/config/config.php'; include "../include/my_functions.php"; include "../include/common.php"; include "../include/openssl_functions.php"; $stage = gpvar('stage'); switch ($stage) { case 'dl_root': upload($config['cacert_pem'], $config['ca_prefix'] . "cacert.crt", 'application/x-x509-ca-cert'); break; case 'dl_crl': upload($config['cacrl_der'], $config['ca_prefix'] . "cacrl.crl", 'application/pkix-crl'); break; case 'gen_crl': list($ret, $errtxt) = CA_generate_crl(); printHeader(false); if ($ret) { ?> <div style="text-align:center"><h2>Certificate Revocation List Updated</h2></div> <p> <form action="<?php echo $PHP_SELF; ?> " method="post"> <input type="submit" name="submit" value="Back to Menu"> </form> <?php print '<pre>' . CA_crl_text() . '</pre>'; } else { ?>
function CA_revoke_cert($serial) { global $config; $fd = fopen($config['index'], 'a'); flock($fd, LOCK_EX); $certfile = $config['new_certs_dir'] . "/{$serial}.pem"; $cmd_output[] = 'Revoking the certificate.'; exec(CA . " -config " . $config['openssl_cnf'] . " -revoke " . escshellarg($certfile) . " -passin pass:"******" 2>&1", $cmd_output, $ret); if ($ret == 0) { unset($cmd_output); list($ret, $cmd_output[]) = CA_generate_crl(); } fclose($fd); return array($ret == true || $ret == 0 ? true : false, implode('<br>', $cmd_output)); }