diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php index df46f277..05c3be28 100644 --- a/tests/Unit/File/X509/X509Test.php +++ b/tests/Unit/File/X509/X509Test.php @@ -1392,4 +1392,16 @@ JYhGgW6KsKViE0hzQB8dSAcNcfwQPSKzOd02crXdJ7uYvZZK9prN83Oe1iDaizeA $this->assertFalse($x509->validateURL('https://aa')); } + + public function testLargeInteger() + { + // cert has an elliptic curve public key with a specified curve (vs a named curve) with + // an excessively large integer value + $cert = file_get_contents(__DIR__ . '/mal-cert-01.der'); + + $x509 = new X509(); + $x509->loadX509($cert); + $this->expectException(\RuntimeException::class); + $x509->getPublicKey(); + } } diff --git a/tests/Unit/File/X509/mal-cert-01.der b/tests/Unit/File/X509/mal-cert-01.der new file mode 100644 index 00000000..3219ccd4 Binary files /dev/null and b/tests/Unit/File/X509/mal-cert-01.der differ