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 を次のようにフォーマットしました。
-----BEGIN CERTIFICATE REQUEST----- MIGYMIGFAgAwbzELMAkGA1UEBgwCUEwxCjAIBgNVBAgMAS4xETAPBgNVBAcMCExlb2Frd2RhMQow [...] dGVzdC5wbDAQMAsGCSqGSIb3DQEBAQMBADALBgkqhkiG9w0BAQUDAQA= -----END CERTIFICATE REQUEST
このコードは私にエラーを与えます:Fatal error: Maximum execution time of 30 seconds exceeded in D:\wamp\www\Math\BigInteger.php on line 1659