aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-05 15:29:11 -0500
committerJack Lloyd <[email protected]>2018-03-05 15:29:11 -0500
commit48409672cfad8aa1b4765fa45cd3634ad496bda8 (patch)
tree7aeb528f219a42b202522b84d3a86d10e89f622b /src/tests
parenta7d664192a7dce877225e6fbe35c3ad4a1d3cceb (diff)
Allow decoding ASN.1 OID 0.0
I had no idea this was a valid OID but apparently it is. And for some who-knows-why reason FreeTSA certificate includes it in their certificate policy extension. GH #355
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/data/asn1_print/input6.derbin0 -> 2053 bytes
-rw-r--r--src/tests/data/asn1_print/input6.pem45
-rw-r--r--src/tests/data/asn1_print/output6.txt145
-rw-r--r--src/tests/test_asn1.cpp2
4 files changed, 191 insertions, 1 deletions
diff --git a/src/tests/data/asn1_print/input6.der b/src/tests/data/asn1_print/input6.der
new file mode 100644
index 000000000..ab6cac565
--- /dev/null
+++ b/src/tests/data/asn1_print/input6.der
Binary files differ
diff --git a/src/tests/data/asn1_print/input6.pem b/src/tests/data/asn1_print/input6.pem
new file mode 100644
index 000000000..467926276
--- /dev/null
+++ b/src/tests/data/asn1_print/input6.pem
@@ -0,0 +1,45 @@
+-----BEGIN CERTIFICATE-----
+MIIIATCCBemgAwIBAgIJAMHphhYNqOmCMA0GCSqGSIb3DQEBDQUAMIGVMREwDwYD
+VQQKEwhGcmVlIFRTQTEQMA4GA1UECxMHUm9vdCBDQTEYMBYGA1UEAxMPd3d3LmZy
+ZWV0c2Eub3JnMSIwIAYJKoZIhvcNAQkBFhNidXNpbGV6YXNAZ21haWwuY29tMRIw
+EAYDVQQHEwlXdWVyemJ1cmcxDzANBgNVBAgTBkJheWVybjELMAkGA1UEBhMCREUw
+HhcNMTYwMzEzMDE1NzM5WhcNMjYwMzExMDE1NzM5WjCCAQkxETAPBgNVBAoTCEZy
+ZWUgVFNBMQwwCgYDVQQLEwNUU0Ex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ZdEmCSjroAnoA0Ka4yTPlvBCNU
+83vKWv3cefeTRqs4i/x58B3JhhJU6mzBKZQQdrg9IFVvO+UTJoN/KHb3gzs3Dnw9
+QQUjgn1PU0AMciGNdSKf8QxviJOpo6HAxCu0yJjBPfQcf2VztPxWUVlxphCnsNKF
+fIIlqfsgTqzsouiXGqGvh4hqKuPHL+CgquhCmAp3vvFrkhFUWAkNmCtZRmA3ZOda
+CtPRFFS5mG9ni5q2r+hJcDOuOr/U60O3vJ3uaIFZSeZIFYKoLnhSd/IoIQfv45Ag
+DgUIrLjqguolBSdvPJ2io9O0rTi7+IQr2jb8JEgpH1WNwC3R4A==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/asn1_print/output6.txt b/src/tests/data/asn1_print/output6.txt
new file mode 100644
index 000000000..d9c326af1
--- /dev/null
+++ b/src/tests/data/asn1_print/output6.txt
@@ -0,0 +1,145 @@
+ d= 0, l=2049: SEQUENCE
+ d= 1, l=1513: SEQUENCE
+ d= 2, l= 3: cons [0] context
+ d= 3, l= 1: INTEGER 02
+ d= 2, l= 9: INTEGER C1E986160DA8E982
+ d= 2, l= 13: SEQUENCE
+ d= 3, l= 9: OBJECT RSA/EMSA3(SHA-512) [1.2.840.113549.1.1.13]
+ d= 3, l= 0: NULL
+ d= 2, l= 149: SEQUENCE
+ d= 3, l= 17: SET
+ d= 4, l= 15: SEQUENCE
+ d= 5, l= 3: OBJECT X520.Organization [2.5.4.10]
+ d= 5, l= 8: PRINTABLE STRING Free TSA
+ d= 3, l= 16: SET
+ d= 4, l= 14: SEQUENCE
+ d= 5, l= 3: OBJECT X520.OrganizationalUnit [2.5.4.11]
+ d= 5, l= 7: PRINTABLE STRING Root CA
+ d= 3, l= 24: SET
+ d= 4, l= 22: SEQUENCE
+ d= 5, l= 3: OBJECT X520.CommonName [2.5.4.3]
+ d= 5, l= 15: PRINTABLE STRING www.freetsa.org
+ d= 3, l= 34: SET
+ d= 4, l= 32: SEQUENCE
+ d= 5, l= 9: OBJECT PKCS9.EmailAddress [1.2.840.113549.1.9.1]
+ d= 5, l= 19: IA5 STRING [email protected]
+ d= 3, l= 18: SET
+ d= 4, l= 16: SEQUENCE
+ d= 5, l= 3: OBJECT X520.Locality [2.5.4.7]
+ d= 5, l= 9: PRINTABLE STRING Wuerzburg
+ d= 3, l= 15: SET
+ d= 4, l= 13: SEQUENCE
+ d= 5, l= 3: OBJECT X520.State [2.5.4.8]
+ d= 5, l= 6: PRINTABLE STRING Bayern
+ d= 3, l= 11: SET
+ d= 4, l= 9: SEQUENCE
+ d= 5, l= 3: OBJECT X520.Country [2.5.4.6]
+ d= 5, l= 2: PRINTABLE STRING DE
+ d= 2, l= 30: SEQUENCE
+ d= 3, l= 13: UTC TIME 2016/03/13 01:57:39 UTC
+ d= 3, l= 13: UTC TIME 2026/03/11 01:57:39 UTC
+ d= 2, l= 265: SEQUENCE
+ d= 3, l= 17: SET
+ d= 4, l= 15: SEQUENCE
+ d= 5, l= 3: OBJECT X520.Organization [2.5.4.10]
+ d= 5, l= 8: PRINTABLE STRING Free TSA
+ d= 3, l= 12: SET
+ d= 4, l= 10: SEQUENCE
+ d= 5, l= 3: OBJECT X520.OrganizationalUnit [2.5.4.11]
+ d= 5, l= 3: PRINTABLE STRING TSA
+ d= 3, l= 118: SET
+ d= 4, l= 116: SEQUENCE
+ d= 5, l= 3: OBJECT 2.5.4.13
+ d= 5, l= 109: PRINTABLE STRING This certificate digitally signs documents and time stamp requests made using the freetsa.org online services
+ d= 3, l= 24: SET
+ d= 4, l= 22: SEQUENCE
+ d= 5, l= 3: OBJECT X520.CommonName [2.5.4.3]
+ d= 5, l= 15: PRINTABLE STRING www.freetsa.org
+ d= 3, l= 34: SET
+ d= 4, l= 32: SEQUENCE
+ d= 5, l= 9: OBJECT PKCS9.EmailAddress [1.2.840.113549.1.9.1]
+ d= 5, l= 19: IA5 STRING [email protected]
+ d= 3, l= 18: SET
+ d= 4, l= 16: SEQUENCE
+ d= 5, l= 3: OBJECT X520.Locality [2.5.4.7]
+ d= 5, l= 9: PRINTABLE STRING Wuerzburg
+ d= 3, l= 11: SET
+ d= 4, l= 9: SEQUENCE
+ d= 5, l= 3: OBJECT X520.Country [2.5.4.6]
+ d= 5, l= 2: PRINTABLE STRING DE
+ d= 3, l= 15: SET
+ d= 4, l= 13: SEQUENCE
+ d= 5, l= 3: OBJECT X520.State [2.5.4.8]
+ d= 5, l= 6: PRINTABLE STRING Bayern
+ d= 2, l= 546: SEQUENCE
+ d= 3, l= 13: SEQUENCE
+ d= 4, l= 9: OBJECT RSA [1.2.840.113549.1.1.1]
+ d= 4, l= 0: NULL
+ d= 3, l= 527: BIT STRING
+ d= 4, l= 522: SEQUENCE
+ d= 5, l= 513: INTEGER B591048C4E486F34E9DC08627FC2375162236984B82CB130BEFF517CFC38F84BCE5C65A874DAB2621AE0BCE7E33563E0EDE934FD5F8823159F07848808227460C1ED88261706F4281334359DFBB81BD1353FC179610AF1A8C8C865DC00EA23B3A89BE6BD03BA85A9EC827D60565905E22D6A584ED1380AE150280CEE397E98A012F380464007862443BC077CB95F421AF31712D9683CDB6DFFBAF3C8BA5BA566AE523D459D6177346D4D840E27886B7C01C5B890D78A2E27BBA8DD2F9A2812E157D62F921C65962548069DCDB7D06DE181DE0E9570D66F87220CE28B628AB55906F3EE0C210F7051E8F4858AF8B9A92D09E46AF2D9CBA5BFCFAD168CDF604491A4B06603B114CAF7031F065E7EEEFA53C575F3490C059D2E32DDC76AC4D4C4C710683B97FD1BE591BC61055186D88F9A0391B307B6F91ED954DAA36F9ACD6A1E14AA2E4ADF17464B54DB18DBB6FFE30080246547370436CE4E77BAE5DE6FE0F3F9D6E7FFBEB461E794E92FB0951F8AAE61A412CCE9B21074635C8BE327AE1A0F6B4A646EB0F8463BC63BF845530435D19E802511EC9F66C3496952D8BECB69B0AA4D4C41F60515FE7DCBB89319CDDA59BA6AEA4BE3CEAE718E6FCB6CCD7DB9FC50BB15B12F3665B0AA307289C2E6DD4B111CE48BA2D9EFDB5A6B9A506069334FB34F6FC7AE330F0B34208AAC80DF3266FDD90465876BA2CB898D9505315B6E7B
+ d= 5, l= 3: INTEGER 010001
+ d= 2, l= 475: cons [3] context
+ d= 3, l= 471: SEQUENCE
+ d= 4, l= 9: SEQUENCE
+ d= 5, l= 3: OBJECT X509v3.BasicConstraints [2.5.29.19]
+ d= 5, l= 2: OCTET STRING
+ d= 6, l= 0: SEQUENCE
+ d= 4, l= 29: SEQUENCE
+ d= 5, l= 3: OBJECT X509v3.SubjectKeyIdentifier [2.5.29.14]
+ d= 5, l= 22: OCTET STRING
+ d= 6, l= 20: OCTET STRING 6E760B7B4E4F9CE160CA6D2CE927A2A294B37737
+ d= 4, l= 31: SEQUENCE
+ d= 5, l= 3: OBJECT X509v3.AuthorityKeyIdentifier [2.5.29.35]
+ d= 5, l= 24: OCTET STRING
+ d= 6, l= 22: SEQUENCE
+ d= 7, l= 20: [0] context 8014FA550D8C346651434CF7E7B3A76C95AF7AE6A497
+ d= 4, l= 11: SEQUENCE
+ d= 5, l= 3: OBJECT X509v3.KeyUsage [2.5.29.15]
+ d= 5, l= 4: OCTET STRING
+ d= 6, l= 2: BIT STRING C0
+ d= 4, l= 22: SEQUENCE
+ d= 5, l= 3: OBJECT X509v3.ExtendedKeyUsage [2.5.29.37]
+ d= 5, l= 1: BOOLEAN true
+ d= 5, l= 12: OCTET STRING
+ d= 6, l= 10: SEQUENCE
+ d= 7, l= 8: OBJECT PKIX.TimeStamping [1.3.6.1.5.5.7.3.8]
+ d= 4, l= 99: SEQUENCE
+ d= 5, l= 8: OBJECT PKIX.AuthorityInformationAccess [1.3.6.1.5.5.7.1.1]
+ d= 5, l= 87: OCTET STRING
+ d= 6, l= 85: SEQUENCE
+ d= 7, l= 42: SEQUENCE
+ d= 8, l= 8: OBJECT PKIX.CertificateAuthorityIssuers [1.3.6.1.5.5.7.48.2]
+ d= 8, l= 30: [6] context 861E687474703A2F2F7777772E667265657473612E6F72672F7473612E637274
+ d= 7, l= 39: SEQUENCE
+ d= 8, l= 8: OBJECT PKIX.OCSP [1.3.6.1.5.5.7.48.1]
+ d= 8, l= 27: [6] context 861B687474703A2F2F7777772E667265657473612E6F72673A32353630
+ d= 4, l= 55: SEQUENCE
+ d= 5, l= 3: OBJECT X509v3.CRLDistributionPoints [2.5.29.31]
+ d= 5, l= 48: OCTET STRING
+ d= 6, l= 46: SEQUENCE
+ d= 7, l= 44: SEQUENCE
+ d= 8, l= 42: cons [0] context
+ d= 9, l= 40: cons [0] context
+ d=10, l= 38: [6] context 8626687474703A2F2F7777772E667265657473612E6F72672F63726C2F726F6F745F63612E63726C
+ d= 4, l= 198: SEQUENCE
+ d= 5, l= 3: OBJECT X509v3.CertificatePolicies [2.5.29.32]
+ d= 5, l= 190: OCTET STRING
+ d= 6, l= 187: SEQUENCE
+ d= 7, l= 184: SEQUENCE
+ d= 8, l= 1: OBJECT 0.0
+ d= 8, l= 178: SEQUENCE
+ d= 9, l= 51: SEQUENCE
+ d=10, l= 8: OBJECT 1.3.6.1.5.5.7.2.1
+ d=10, l= 39: IA5 STRING http://www.freetsa.org/freetsa_cps.html
+ d= 9, l= 50: SEQUENCE
+ d=10, l= 8: OBJECT 1.3.6.1.5.5.7.2.1
+ d=10, l= 38: IA5 STRING http://www.freetsa.org/freetsa_cps.pdf
+ d= 9, l= 71: SEQUENCE
+ d=10, l= 8: OBJECT 1.3.6.1.5.5.7.2.2
+ d=10, l= 59: SEQUENCE
+ d=11, l= 57: VISIBLE STRING FreeTSA trusted timestamping Software as a Service (SaaS)
+ d= 1, l= 13: SEQUENCE
+ d= 2, l= 9: OBJECT RSA/EMSA3(SHA-512) [1.2.840.113549.1.1.13]
+ d= 2, l= 0: NULL
+ d= 1, l= 513: BIT STRING A5C944E2C6FAC0A14D930A7FD0A0B172B41FC1483C3E957C68A2BCD9B9764F1A950161FD72472D41A5EED277786203B5422240FB3A26CDE176087B6FB1011DF4CC19E2571AA4A051109665E94C46F50BD2ADEE6AC4137E251B25A39DABDA451515D8FF9E07209E8EC20B7874F7E1A0EDE7C00937FE84A334F8B3265CED2D8ED9DF61396583677FEB382C1EE3B23E6EA5F05DF30DE7B9F89005D25266F612F39C8B4F6DABA6D7BFBAC19632B90637329F52A6F066A10E43EAA81F849A6C5FE3FE8B5EA23275F687F2052E502EA6C30762A668CCE07871DD8E97E315BBA929E25589977A0A312CE96C5106B1437C779F2B361B182888F3EE8A234374FA063E956192627F7C431073965D1260928EBA009E803429AE324CF96F042354F37BCA5AFDDC79F79346AB388BFC79F01DC9861254EA6CC129941076B83D20556F3BE51326837F2876F7833B370E7C3D410523827D4F53400C72218D75229FF10C6F8893A9A3A1C0C42BB4C898C13DF41C7F6573B4FC56515971A610A7B0D2857C8225A9FB204EACECA2E8971AA1AF87886A2AE3C72FE0A0AAE842980A77BEF16B92115458090D982B5946603764E75A0AD3D11454B9986F678B9AB6AFE8497033AE3ABFD4EB43B7BC9DEE68815949E6481582A82E785277F2282107EFE390200E0508ACB8EA82EA2505276F3C9DA2A3D3B4AD38BBF8842BDA36FC2448291F558DC02DD1E0
diff --git a/src/tests/test_asn1.cpp b/src/tests/test_asn1.cpp
index 857754745..ae9c1dafb 100644
--- a/src/tests/test_asn1.cpp
+++ b/src/tests/test_asn1.cpp
@@ -300,7 +300,7 @@ class ASN1_Printer_Tests final : public Test
Botan::ASN1_Pretty_Printer printer;
- const size_t num_tests = 5;
+ const size_t num_tests = 6;
for(size_t i = 1; i <= num_tests; ++i)
{