我想与我的 CA 签署一份 CSR。我从phpseclib 中获取了这段代码的一些部分:X.509 示例
<?php
include('File/X509.php');
include('Crypt/RSA.php');
$c = $_POST['csr'];
$CAPrivKey = new Crypt_RSA();
$CAPrivKey->setPassword('PrivatePassword');
$CAPrivKey->loadKey("-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,47EF178926906B55
lVtuTcJ1etpRaUT9086Vm5dsop8o5D92VVubcyhI268ZG4frRCBR4yuyORp+zdS2
[...]
gyx636VRV7aekLc6IFHJ56MzZRA/23izSooWqAJLTGEBrc4CWuodj9cc/+p3+9zC
-----END RSA PRIVATE KEY-----
");
$issuer = new File_X509();
$issuer->setPrivateKey($CAPrivKey);
$issuer->loadX509("-----BEGIN CERTIFICATE-----
MIIK0zCCBrugAwIBAgIJAPzTFDuzmcUcMA0GCSqGSIb3DQEBBQUAMIGhMQswCQYD
[...]
6F5Ji6w2IfD6xFhgvyTmqYgsae3+DEX6TAJosaI0EJQz6vYeubQb
-----END CERTIFICATE-----
");
$subject = new File_X509();
$subject->loadCSR($c);
$x509 = new File_X509();
$x509->setStartDate('-1 month');
$x509->setEndDate('+1 year');
$result = $x509->sign($issuer, $subject);
echo $x509->saveX509($result);
?>
在 $csr 中,我以这种方式格式化了 CSR:
-----开始证书申请----- MIGYMIGFAgAwbzELMAkGA1UEBgwCUEwxCjAIBgNVBAgMAS4xETAPBgNVBAcMCExlb2Frd2RhMQow [...] dGVzdC5wbDAQMAsGCSqGSIb3DQEBAQMBADALBgkqhkiG9w0BAQUDAQA=-----结束证书申请--
这段代码给了我错误:Fatal error: Maximum execution time of 30 seconds exceeded in D:\wamp\www\Math\BigInteger.php on line 1659