certificationauthority : Add alternative names
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5109 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -123,4 +123,24 @@ class test_certificationauthority extends PHPUnit_Framework_TestCase
|
||||
unlink ("/tmp/test_signCSR_5");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
|
||||
public function test_signCSR_6 ()
|
||||
{
|
||||
// Check if generated cert has Alternative Names
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
$caKey = $certificationauthority->caKey ();
|
||||
$csr = $certificationauthority->createCSR ("FR", "FOURNIER38",
|
||||
"CSR.fournier38.fr");
|
||||
$cert = $certificationauthority->signCSR ($csr, $caCert, $caKey, null,
|
||||
["ALT1.example.com","ALT2.example.com"]);
|
||||
file_put_contents ("/tmp/test_signCSR_6", $cert);
|
||||
exec ("openssl x509 -in - -text -noout < /tmp/test_signCSR_6", $output);
|
||||
$res = preg_match ("#DNS:CSR.fournier38.fr, DNS:ALT1.example.com, DNS:ALT#",
|
||||
implode ("\n", $output));
|
||||
print_r ($output);
|
||||
unlink ("/tmp/test_signCSR_6");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user