@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | // load RSA private key from PEM |
24 | 24 | $private_key_info = PrivateKeyInfo::fromPEM( |
25 | - PEM::fromFile(dirname(__DIR__) . '/test/assets/rsa/private_key.pem')); |
|
25 | + PEM::fromFile(dirname(__DIR__) . '/test/assets/rsa/private_key.pem')); |
|
26 | 26 | // extract public key from private key |
27 | 27 | $public_key_info = $private_key_info->publicKeyInfo(); |
28 | 28 | // DN of the certification authority |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | // create "to be signed" certificate object with extensions |
33 | 33 | $tbs_cert = new TBSCertificate($name, $public_key_info, $name, $validity); |
34 | 34 | $tbs_cert = $tbs_cert->withRandomSerialNumber()->withAdditionalExtensions( |
35 | - new BasicConstraintsExtension(true, true), |
|
36 | - new SubjectKeyIdentifierExtension(false, $public_key_info->keyIdentifier()), |
|
37 | - new KeyUsageExtension(true, |
|
38 | - KeyUsageExtension::DIGITAL_SIGNATURE | KeyUsageExtension::KEY_CERT_SIGN)); |
|
35 | + new BasicConstraintsExtension(true, true), |
|
36 | + new SubjectKeyIdentifierExtension(false, $public_key_info->keyIdentifier()), |
|
37 | + new KeyUsageExtension(true, |
|
38 | + KeyUsageExtension::DIGITAL_SIGNATURE | KeyUsageExtension::KEY_CERT_SIGN)); |
|
39 | 39 | // sign certificate with private key |
40 | 40 | $algo = SignatureAlgorithmIdentifierFactory::algoForAsymmetricCrypto( |
41 | - $private_key_info->algorithmIdentifier(), new SHA256AlgorithmIdentifier()); |
|
41 | + $private_key_info->algorithmIdentifier(), new SHA256AlgorithmIdentifier()); |
|
42 | 42 | $cert = $tbs_cert->sign($algo, $private_key_info); |
43 | 43 | echo $cert; |