aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/data/x509test
diff options
context:
space:
mode:
authorMouse <[email protected]>2015-10-27 15:24:39 -0400
committerMouse <[email protected]>2015-10-27 15:24:39 -0400
commita4966294751e503f97cfc3826308e43415c662c7 (patch)
tree43f7b6f6f763a4b5627ce0e723465ce6fb3eca89 /src/tests/data/x509test
parentf6f0b152e6c46ad499eec2b8f3973a3a678f3008 (diff)
parenta38d045acf208390b04c03f6473783e71be93168 (diff)
Merge pull request #7 from randombit/master
Update to match current Botan
Diffstat (limited to 'src/tests/data/x509test')
-rw-r--r--src/tests/data/x509test/InvalidExtendedKeyUsage.pem39
-rw-r--r--src/tests/data/x509test/InvalidIntCAFlag.pem97
-rw-r--r--src/tests/data/x509test/InvalidIntCAKeyUsage.pem97
-rw-r--r--src/tests/data/x509test/InvalidIntCALen.pem97
-rw-r--r--src/tests/data/x509test/InvalidIntCALoop.pem79
-rw-r--r--src/tests/data/x509test/InvalidIntCASelfSign.pem79
-rw-r--r--src/tests/data/x509test/InvalidIntCAVersionOne.pem97
-rw-r--r--src/tests/data/x509test/InvalidIntCAVersionTwo.pem97
-rw-r--r--src/tests/data/x509test/InvalidKeyUsage.pem38
-rw-r--r--src/tests/data/x509test/InvalidName.pem38
-rw-r--r--src/tests/data/x509test/InvalidNameAltName.pem39
-rw-r--r--src/tests/data/x509test/InvalidNameAltNameWithSubj.pem38
-rw-r--r--src/tests/data/x509test/InvalidNameConstraintExclude.pem99
-rw-r--r--src/tests/data/x509test/InvalidNameConstraintPermit.pem99
-rw-r--r--src/tests/data/x509test/InvalidNameConstraintPermitRight.pem99
-rw-r--r--src/tests/data/x509test/InvalidNameConstraintPermitThenExclude.pem100
-rw-r--r--src/tests/data/x509test/InvalidNotAfter.pem37
-rw-r--r--src/tests/data/x509test/InvalidNotAfterChained.pem97
-rw-r--r--src/tests/data/x509test/InvalidNotBefore.pem37
-rw-r--r--src/tests/data/x509test/InvalidNotBeforeChained.pem97
-rw-r--r--src/tests/data/x509test/InvalidSelfSign.pem18
-rw-r--r--src/tests/data/x509test/InvalidWildcardAll.pem37
-rw-r--r--src/tests/data/x509test/InvalidWildcardAllAltName.pem38
-rw-r--r--src/tests/data/x509test/InvalidWildcardLeft.pem37
-rw-r--r--src/tests/data/x509test/InvalidWildcardLeftAltName.pem38
-rw-r--r--src/tests/data/x509test/InvalidWildcardMid.pem37
-rw-r--r--src/tests/data/x509test/InvalidWildcardMidAltName.pem38
-rw-r--r--src/tests/data/x509test/InvalidWildcardMidMixed.pem37
-rw-r--r--src/tests/data/x509test/InvalidWildcardMidMixedAltName.pem38
-rw-r--r--src/tests/data/x509test/InvalidWildcardSingle.pem37
-rw-r--r--src/tests/data/x509test/InvalidWildcardSingleAltName.pem38
-rw-r--r--src/tests/data/x509test/MissingIntCABasicConstraintWithCertSign.pem97
-rw-r--r--src/tests/data/x509test/MissingIntCAExtensions.pem97
-rw-r--r--src/tests/data/x509test/ValidAltName.pem38
-rw-r--r--src/tests/data/x509test/ValidCert.pem37
-rw-r--r--src/tests/data/x509test/ValidChained.pem97
-rw-r--r--src/tests/data/x509test/ValidIntCALen.pem97
-rw-r--r--src/tests/data/x509test/ValidNameConstraint.pem100
-rw-r--r--src/tests/data/x509test/ValidWildcard.pem37
-rw-r--r--src/tests/data/x509test/expected.txt43
-rw-r--r--src/tests/data/x509test/root.pem19
41 files changed, 2555 insertions, 0 deletions
diff --git a/src/tests/data/x509test/InvalidExtendedKeyUsage.pem b/src/tests/data/x509test/InvalidExtendedKeyUsage.pem
new file mode 100644
index 000000000..1077d478f
--- /dev/null
+++ b/src/tests/data/x509test/InvalidExtendedKeyUsage.pem
@@ -0,0 +1,39 @@
+-----BEGIN CERTIFICATE-----
+MIIDNTCCAp6gAwIBAgICBTYwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aW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+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidIntCAFlag.pem b/src/tests/data/x509test/InvalidIntCAFlag.pem
new file mode 100644
index 000000000..bf8eadbb4
--- /dev/null
+++ b/src/tests/data/x509test/InvalidIntCAFlag.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBVMwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDI3WhcNMTYxMDIxMTYyMDI3WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEA1OL+Ud1tnY7uAY1FHW5aj+I9WSeeaZdgdnofZC8lKGq6HbbD
+vC1BQZyqwQBTOdInwHeMtrn8OZiGjsDEi9VCSZsRWILxdM78kZ/+dE79icFns4is
+Wnl7qjqybI8WTpRZRgYl3sCgwm0Ewn8mcfDSjQ0P1VhtEjI2Qc62LCaHA0ECAwEA
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IwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidIntCAKeyUsage.pem b/src/tests/data/x509test/InvalidIntCAKeyUsage.pem
new file mode 100644
index 000000000..46ea7094f
--- /dev/null
+++ b/src/tests/data/x509test/InvalidIntCAKeyUsage.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBWswDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgk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NFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidIntCALen.pem b/src/tests/data/x509test/InvalidIntCALen.pem
new file mode 100644
index 000000000..66b70d725
--- /dev/null
+++ b/src/tests/data/x509test/InvalidIntCALen.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBWMwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDI3WhcNMTYxMDIxMTYyMDI3WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAwhW8qYanEvDgb9ZTsgnBpLN2lb79VTAOEuvV7g1mMi2FtH7C
+pCxL6V0Qo/tIEszrG5M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BAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidIntCALoop.pem b/src/tests/data/x509test/InvalidIntCALoop.pem
new file mode 100644
index 000000000..bdc130f46
--- /dev/null
+++ b/src/tests/data/x509test/InvalidIntCALoop.pem
@@ -0,0 +1,79 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBXswDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW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t4ZHwj8SAP0X6iBGbEWpDf1IbZcU
+pNcsE2lAo0zIWV9ShhuVBGNOWVxiCWyPeQGPUm/oQX4rDu3hhKK0ff5DHrIkeQOd
+R3vSw2U9ftWGC7ah/mImTIlZGVfas+SKAZMv91YnandHHlIzEtv8Yqn1nLMezjU9
+FSI=
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidIntCASelfSign.pem b/src/tests/data/x509test/InvalidIntCASelfSign.pem
new file mode 100644
index 000000000..212cad56f
--- /dev/null
+++ b/src/tests/data/x509test/InvalidIntCASelfSign.pem
@@ -0,0 +1,79 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBV8wDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDI3WhcNMTYxMDIxMTYyMDI3WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAsom1fnARuMevEExpCF56bBFF6U0bVkBX2Uc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sBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxHjAcBgNVBAMMFWludC5sZXYxLmNhLmF1
+dGhvcml0eTEfMB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkq
+hkiG9w0BAQEFAAOBjQAwgYkCgYEAzPLH+D/L14UV4upNVj8GUzVK0hPqnN3x6Lzy
+u/1rXne9nhP+HB/toJUe/VeRw+xs3aVpPE1z9Fx/+h5hmzxM8CmxifdBkhI61AwH
+/X/8z+wKfmo5mKTYbP13wHg6aZjlDnKWnabvUYv2VUqfffa9mz+lY8wVm4OTtRXS
+v2hI+sUCAwEAAaMjMCEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
+DQYJKoZIhvcNAQEFBQADgYEAXW153EIEyP0VOyYWIqLMz77XShXmckYKbBKS/kWH
+7iYaZhy6Jw1MXluiQ2kYzgxbjBXvFlGo0IOKTnU05NmCOGU3bgBIiZ/oTiQcSges
+Omqg7oK85c/kFEQ3QrboJZ+w5HgDtp3Bi6U1qESfnvsjwWhqnXmmtd77z/w0vFYp
+t5M=
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidIntCAVersionOne.pem b/src/tests/data/x509test/InvalidIntCAVersionOne.pem
new file mode 100644
index 000000000..135b25929
--- /dev/null
+++ b/src/tests/data/x509test/InvalidIntCAVersionOne.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBXMwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL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DNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidIntCAVersionTwo.pem b/src/tests/data/x509test/InvalidIntCAVersionTwo.pem
new file mode 100644
index 000000000..09e51407d
--- /dev/null
+++ b/src/tests/data/x509test/InvalidIntCAVersionTwo.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBXcwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDI4WhcNMTYxMDIxMTYyMDI4WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAxFCLLNsJzBo7D7ORMhtuSVDjU+GpAiLYREeDtFnazGUgwlUr
+vdUo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PU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidKeyUsage.pem b/src/tests/data/x509test/InvalidKeyUsage.pem
new file mode 100644
index 000000000..dfaf41b5c
--- /dev/null
+++ b/src/tests/data/x509test/InvalidKeyUsage.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDDzCCAnigAwIBAgICBRcwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+D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QQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidName.pem b/src/tests/data/x509test/InvalidName.pem
new file mode 100644
index 000000000..1d911713d
--- /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slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNameAltName.pem b/src/tests/data/x509test/InvalidNameAltName.pem
new file mode 100644
index 000000000..432c5f7b4
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNameAltName.pem
@@ -0,0 +1,39 @@
+-----BEGIN CERTIFICATE-----
+MIIDNTCCAp6gAwIBAgICBSUwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAyMloXDTE2MTAyMTE2MjAyMlowgc0xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMSIwIAYDVQQDDBl3d3cudGxzLnRlc3QuaW52YWxp
+ZC50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqG
+SIb3DQEBAQUAA4GNADCBiQKBgQCwjxxDC308U7KsLzaApJrUDI8sMKP4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QYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNameAltNameWithSubj.pem b/src/tests/data/x509test/InvalidNameAltNameWithSubj.pem
new file mode 100644
index 000000000..906df5abf
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNameAltNameWithSubj.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDKDCCApGgAwIBAgICBX0wDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAzNFoXDTE2MTAyMTE2MjAzNFowgcAxCzAJBgNVB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S50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNameConstraintExclude.pem b/src/tests/data/x509test/InvalidNameConstraintExclude.pem
new file mode 100644
index 000000000..9cc79586d
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNameConstraintExclude.pem
@@ -0,0 +1,99 @@
+-----BEGIN CERTIFICATE-----
+MIIDHTCCAoagAwIBAgICBZ0wDQYJKoZIhvcNAQEFBQAwgckxC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Db21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNameConstraintPermit.pem b/src/tests/data/x509test/InvalidNameConstraintPermit.pem
new file mode 100644
index 000000000..3aece322f
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNameConstraintPermit.pem
@@ -0,0 +1,99 @@
+-----BEGIN CERTIFICATE-----
+MIIDHTCCAoagAwIBAgICBaEwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3Jp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CpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNameConstraintPermitRight.pem b/src/tests/data/x509test/InvalidNameConstraintPermitRight.pem
new file mode 100644
index 000000000..00da5076a
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNameConstraintPermitRight.pem
@@ -0,0 +1,99 @@
+-----BEGIN CERTIFICATE-----
+MIIDHTCCAoagAwIBAgICBaUwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDM1WhcNMTYxMDIxMTYyMDM1WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjA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h9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNameConstraintPermitThenExclude.pem b/src/tests/data/x509test/InvalidNameConstraintPermitThenExclude.pem
new file mode 100644
index 000000000..fedfe2893
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNameConstraintPermitThenExclude.pem
@@ -0,0 +1,100 @@
+-----BEGIN CERTIFICATE-----
+MIIDHTCCAoagAwIBAgICBakwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDM1WhcNMTYxMDIxMTYyMDM1WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEA4Z/pPfSMPZgg/bImH0j8j8+4qDDsZWCRa7Ra7KSkD/PoxBcl
+qA/KBo0h0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QH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNotAfterChained.pem b/src/tests/data/x509test/InvalidNotAfterChained.pem
new file mode 100644
index 000000000..25ae1c861
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNotAfterChained.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBTAwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDIyWhcNMTYxMDIxMTYyMDIyWjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCg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haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidNotBefore.pem b/src/tests/data/x509test/InvalidNotBefore.pem
new file mode 100644
index 000000000..4e18b4bdf
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNotBefore.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIC+zCCAmSgAwIBAgICBTEwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU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ff --git a/src/tests/data/x509test/InvalidNotBeforeChained.pem b/src/tests/data/x509test/InvalidNotBeforeChained.pem
new file mode 100644
index 000000000..412eb578c
--- /dev/null
+++ b/src/tests/data/x509test/InvalidNotBeforeChained.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBU8wDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDI0WhcNMTYxMDIxMTYyMDI0WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAwvYZAtfuvra0iFtp2F+zznHtGNMQDH0wpAuQLpLf2kp/vEXV
+eBYwq5m9s16trYLC+y9vaC1pgQQfixuQA9xY3DswQyPIztcIPz8r9LQL5YQ8EDzo
+mm64G+WZ7kn5xX4zCRmX3mS09tQOhe00Thqg+JIkcmoG7hGbcEEZ7iZrRocCAwEA
+ATANBgkqhkiG9w0BAQUFAAOBgQAeJrnaVGhx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NTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidSelfSign.pem b/src/tests/data/x509test/InvalidSelfSign.pem
new file mode 100644
index 000000000..e86d22825
--- /dev/null
+++ b/src/tests/data/x509test/InvalidSelfSign.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC9zCCAmCgAwIBAgICBRYwDQYJKoZIhvcNAQEFBQAwgcAxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRUwEwYDVQQDDAx3d3cudGxzLnRl
+c3QxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcNMTUxMDIwMTYy
+MDEzWhcNMTYxMDIxMTYyMDEzWjCBwDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNB
+MRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNlcnRpZmljYXRl
+IFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1MDkgVmVyaWZp
+Y2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEfMB0GCSqGSIb3
+DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
+gYEAqv3vC7ay9UTYAZxJoovYraYkjs8is7YpfsHJXaqvHtPj2xutetMCYcIwVexG
+amD9z5pl14ZGtWUO/K7Yha5Fqhrk49bH/M52dcV/2LnXXeqti+HDVfzsxdc2z311
+RYYc7xQxwo+ubnR69qkGG3KwbdouGTpc47NdI7A0gUkavcMCAwEAATANBgkqhkiG
+9w0BAQUFAAOBgQBmFIcuPVsCwFh9rbOkJfm8rE28xX6ZsY8qXOnZry8J1LBU9EaM
+UNnsRG9VB5XWtdK4eoBJyTixVDz57rRUVO8ElrfYAIfGe95oZlJc00xT3P7UXRMa
+AQia66AIfDbvQG/MWZL4mgCm/DJZLPbUf/3k/ayJmw4O3SPyKJ2/D8KrIw==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardAll.pem b/src/tests/data/x509test/InvalidWildcardAll.pem
new file mode 100644
index 000000000..d5eaf6b12
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardAll.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIC9DCCAl2gAwIBAgICBYQwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZS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oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardLeft.pem b/src/tests/data/x509test/InvalidWildcardLeft.pem
new file mode 100644
index 000000000..e7e0fe605
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardLeft.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIC9TCCAl6gAwIBAgICBYAwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAyOFoXDTE2MTAyMTE2MjAyOFowgboxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMQ8wDQYDVQQDDAYqLnRlc3QxHzAdBgkqhkiG9w0B
+CQEWEHNvbWVvbmVAbWFpbC5jb20wgZ8wDQYJKoZIhvc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HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardLeftAltName.pem b/src/tests/data/x509test/InvalidWildcardLeftAltName.pem
new file mode 100644
index 000000000..f91e83b32
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardLeftAltName.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDIjCCAougAwIBAgICBYMwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAyOFoXDTE2MTAyMTE2MjAyOFowgc0xCzAJBgNVBAY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JKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardMid.pem b/src/tests/data/x509test/InvalidWildcardMid.pem
new file mode 100644
index 000000000..11a9547d1
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardMid.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIC+TCCAmKgAwIBAgICBYkwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQ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341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardMidAltName.pem b/src/tests/data/x509test/InvalidWildcardMidAltName.pem
new file mode 100644
index 000000000..d4a7e0b03
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardMidAltName.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDJjCCAo+gAwIBAgICBYwwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAyOFoXDTE2MTAyMTE2MjAyOFowgc0xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMSIwIAYDVQQDDBl3d3cudGxzLnRlc3QuaW52YWxp
+ZC50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqG
+SIb3DQEBAQUAA4GNADCBiQKBgQCpu+Fwy+cvq04SskVQAQL9ID9QLmipmH/y27Kk
+LKbB7gXUedxMEbJLE5vvaWvVtYO3taAVsuQh6aNt7b8cXSjzXzN9GIE7rVxOSr5b
+3Lc9cqq2B7Jhp9HF/viAMAVvjDWR/MPOkQV0A9tlY640B1yXhwQCCSqI+bvZNgof
+No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G3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardMidMixed.pem b/src/tests/data/x509test/InvalidWildcardMidMixed.pem
new file mode 100644
index 000000000..82c554554
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardMidMixed.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIC+jCCAmOgAwIBAgICBY0wDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAyOFoXDTE2MTAyMTE2MjAyOFowgb8xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlma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bGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardMidMixedAltName.pem b/src/tests/data/x509test/InvalidWildcardMidMixedAltName.pem
new file mode 100644
index 000000000..3e3c4fdd8
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardMidMixedAltName.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDJzCCApCgAwIBAgICBZAwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
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uZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardSingle.pem b/src/tests/data/x509test/InvalidWildcardSingle.pem
new file mode 100644
index 000000000..ef6992c09
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcard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r21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/InvalidWildcardSingleAltName.pem b/src/tests/data/x509test/InvalidWildcardSingleAltName.pem
new file mode 100644
index 000000000..2c4157cc5
--- /dev/null
+++ b/src/tests/data/x509test/InvalidWildcardSingleAltName.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDHTCCAoagAwIBAgICBX8wDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAyOFoXDTE2MTAyMTE2MjAyOFowgc0xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMSIwIAYDVQQDDBl3d3cudGxzLnRlc3QuaW52YWxp
+ZC50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqG
+SIb3DQEBAQUAA4GNADCBiQKBgQDb1MaXH6cTSHnJ6JiXn15cgl1/Y+v3RPpnNwYH
+2kGJYRSxLP0CjZWJxfK5fG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A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/MissingIntCABasicConstraintWithCertSign.pem b/src/tests/data/x509test/MissingIntCABasicConstraintWithCertSign.pem
new file mode 100644
index 000000000..7ed001ef8
--- /dev/null
+++ b/src/tests/data/x509test/MissingIntCABasicConstraintWithCertSign.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBW8wDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDI3WhcNMTYxMDIxMTYyMDI3WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA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ions.pem b/src/tests/data/x509test/MissingIntCAExtensions.pem
new file mode 100644
index 000000000..ce5d7ca25
--- /dev/null
+++ b/src/tests/data/x509test/MissingIntCAExtensions.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBWcwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDI3WhcNMTYxMDIxMTYyMDI3WjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEA11PHrH3zRiw4nwdy3CV8KR0vmJwxLa3k35YuzN49LMyQyeKa
+sYfAX3IQky92z8htlWEyejznIJ60sBPJjfPP6vErjPxvJ9vMtHyj8rSzJMe6E2RU
+Hpo3UXYdYCLm5xUKx6BhUJU2/u7v6gIddXNx7zZa8YibCdOz2gt9t1qnVmkCAwEA
+ATANBgkqhkiG9w0BAQUFAAOBgQBbZA9K2xUGOU9ng1QyCdYFN6hvQeaDmt1hMS57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+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/ValidAltName.pem b/src/tests/data/x509test/ValidAltName.pem
new file mode 100644
index 000000000..5ac372128
--- /dev/null
+++ b/src/tests/data/x509test/ValidAltName.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDKDCCApGgAwIBAgICBX4wDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MjAxMFoXDTE2MTAyMTE2MjAxMFowgc0xCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQ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21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/ValidCert.pem b/src/tests/data/x509test/ValidCert.pem
new file mode 100644
index 000000000..204789966
--- /dev/null
+++ b/src/tests/data/x509test/ValidCert.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIC+zCCAmSgAwIBAgICBRUwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aX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a/src/tests/data/x509test/ValidChained.pem b/src/tests/data/x509test/ValidChained.pem
new file mode 100644
index 000000000..a7248de4c
--- /dev/null
+++ b/src/tests/data/x509test/ValidChained.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBXcwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDEwWhcNMTYxMDIxMTYyMDEwWjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAwCwNoOZ+rgu7MQ9INb8eGNjlTemzlcR4vKXytUDyX06qG2Qm
+0wt+egqkuVIdfEt6yzhZGVysuqZTbwRu8/YVy7P+m4m2SkXa7qwymS/f3JtBLPtG
+iUBN9DKFXufyn3SOspu/NZ4bpqJEJ9w0LUGf1LTGvdPoNYQnT+XAUfVAkNcCAwEA
+ATANBgkqhkiG9w0BAQUFAAOBgQBw6Mirr+EWa2IMUf17Ae2a/KLdcY9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
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/ValidIntCALen.pem b/src/tests/data/x509test/ValidIntCALen.pem
new file mode 100644
index 000000000..68e6cf91c
--- /dev/null
+++ b/src/tests/data/x509test/ValidIntCALen.pem
@@ -0,0 +1,97 @@
+-----BEGIN CERTIFICATE-----
+MIIDADCCAmmgAwIBAgICBVcwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHh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EJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/ValidNameConstraint.pem b/src/tests/data/x509test/ValidNameConstraint.pem
new file mode 100644
index 000000000..3085e0cb3
--- /dev/null
+++ b/src/tests/data/x509test/ValidNameConstraint.pem
@@ -0,0 +1,100 @@
+-----BEGIN CERTIFICATE-----
+MIIDHTCCAoagAwIBAgICBZkwDQYJKoZIhvcNAQEFBQAwgckxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMR4wHAYDVQQDDBVpbnQubGV2My5j
+YS5hdXRob3JpdHkxHzAdBgkqhkiG9w0BCQEWEHNvbWVvbmVAbWFpbC5jb20wHhcN
+MTUxMDIwMTYyMDEwWhcNMTYxMDIxMTYyMDEwWjCBwDELMAkGA1UEBhMCVVMxCzAJ
+BgNVBAgMAkNBMRgwFgYDVQQHDA9TYW4gTHVpcyBPYmlzcG8xLjAsBgNVBAoMJUNl
+cnRpZmljYXRlIFZhbGlkYXRpb24gYW5kIENvbXBsaWFuY2UxIjAgBgNVBAsMGVg1
+MDkgVmVyaWZpY2F0aW9uIENoZWNrZXIxFTATBgNVBAMMDHd3dy50bHMudGVzdDEf
+MB0GCSqGSIb3DQEJARYQc29tZW9uZUBtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEA1YOhYZy3JK18g0L2gYiDNqgFAmEa9BkNCZmnGmhceJDxHWs6
+eAaLAkWLf8OiedGOnVMgZ93e98k1OsjI+Naml//ekxEDaxSdz+QrFwk7naZcgoI+
+SrlhdDg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BWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDI2TejJ3VtoPlkcjQsqbaiMRCtLGdIN7Ful9z7PWU7AVbuJZxD
+QCeFuFmYsCpBgZD3Rw8JaNfMZLKG3D/peIQ/Hjc44BsFR8H9oa0bIDkZN3kS9O80
+vU4urBwTwt9AFDvGPD4UiFulXsAAHDA4KoBg03R56bm2B+8y2JKiGEQ92QIDAQAB
+oxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALqNB/JaqkTX
+slppJEaBHTY5/bGGWwV/0t3WMDNFaMrFgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/ValidWildcard.pem b/src/tests/data/x509test/ValidWildcard.pem
new file mode 100644
index 000000000..80e38c6f4
--- /dev/null
+++ b/src/tests/data/x509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FgcsEY/KjUSyfWh9c6BHOdr21MmNe4YDh
+T8gv9TmcGNsEJRIYD1jly3tCDyA2W0AUIzob1GMGkV8ddKBUrmt/+qLzagxdOrQ0
+dRcxFarWaAJVGhJ+p6kWJt7XJnK341bP
+-----END CERTIFICATE-----
diff --git a/src/tests/data/x509test/expected.txt b/src/tests/data/x509test/expected.txt
new file mode 100644
index 000000000..67e2937eb
--- /dev/null
+++ b/src/tests/data/x509test/expected.txt
@@ -0,0 +1,43 @@
+InvalidExtendedKeyUsage.pem:Invalid usage
+InvalidIntCAFlag.pem:CA certificate not allowed to issue certs
+InvalidIntCAKeyUsage.pem:CA certificate not allowed to issue certs
+InvalidIntCALen.pem:Certificate chain too long
+InvalidIntCALoop.pem:Loop in certificate chain
+InvalidIntCASelfSign.pem:Cannot establish trust
+InvalidIntCAVersionOne.pem:CA certificate not allowed to issue certs
+InvalidIntCAVersionTwo.pem:CA certificate not allowed to issue certs
+InvalidKeyUsage.pem:Invalid usage
+InvalidName.pem:Certificate does not match provided name
+InvalidNameAltName.pem:Certificate does not match provided name
+InvalidNameAltNameWithSubj.pem:Certificate does not match provided name
+InvalidNotAfter.pem:Certificate has expired
+InvalidNotAfterChained.pem:Certificate has expired
+InvalidSelfSign.pem:Cannot establish trust
+InvalidWildcardAll.pem:Certificate does not match provided name
+InvalidWildcardAllAltName.pem:Certificate does not match provided name
+InvalidWildcardLeft.pem:Certificate does not match provided name
+InvalidWildcardLeftAltName.pem:Certificate does not match provided name
+InvalidWildcardMid.pem:Certificate does not match provided name
+InvalidWildcardMidAltName.pem:Certificate does not match provided name
+InvalidWildcardMidMixed.pem:Certificate does not match provided name
+InvalidWildcardMidMixedAltName.pem:Certificate does not match provided name
+InvalidWildcardSingle.pem:Certificate does not match provided name
+InvalidWildcardSingleAltName.pem:Certificate does not match provided name
+MissingIntCABasicConstraintWithCertSign.pem:CA certificate not allowed to issue certs
+MissingIntCAExtensions.pem:CA certificate not allowed to issue certs
+ValidAltName.pem:Verified
+ValidCert.pem:Verified
+ValidChained.pem:Verified
+ValidIntCALen.pem:Verified
+ValidWildcard.pem:Verified
+
+# Need to fix date settings in x509test and regen
+#InvalidNotBefore.pem:Certificate is not yet valid
+#InvalidNotBeforeChained.pem:Certificate is not yet valid
+
+# Missing name constraints
+InvalidNameConstraintExclude.pem:Certificate issuer not found
+InvalidNameConstraintPermit.pem:Certificate issuer not found
+InvalidNameConstraintPermitRight.pem:Certificate issuer not found
+InvalidNameConstraintPermitThenExclude.pem:Certificate issuer not found
+ValidNameConstraint.pem:Certificate issuer not found
diff --git a/src/tests/data/x509test/root.pem b/src/tests/data/x509test/root.pem
new file mode 100644
index 000000000..b6b894a04
--- /dev/null
+++ b/src/tests/data/x509test/root.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDFDCCAn2gAwIBAgICA+kwDQYJKoZIhvcNAQEFBQAwgcQxCzAJBgNVBAYTAlVT
+MQswCQYDVQQIDAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQK
+DCVDZXJ0aWZpY2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQL
+DBlYNTA5IFZlcmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUw
+OS50ZXN0MR8wHQYJKoZIhvcNAQkBFhBzb21lb25lQG1haWwuY29tMB4XDTE1MTAy
+MDE2MDM1OFoXDTE2MTAyMTE2MDM1OFowgcQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
+DAJDQTEYMBYGA1UEBwwPU2FuIEx1aXMgT2Jpc3BvMS4wLAYDVQQKDCVDZXJ0aWZp
+Y2F0ZSBWYWxpZGF0aW9uIGFuZCBDb21wbGlhbmNlMSIwIAYDVQQLDBlYNTA5IFZl
+cmlmaWNhdGlvbiBDaGVja2VyMRkwFwYDVQQDDBB2ZXJpZnkueDUwOS50ZXN0MR8w
+HQYJKoZIhvcNAQkBFhBzb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