Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: net/data/parse_certificate_unittest/version1.pem

Issue 1279963003: Add a function for parsing RFC 5280's "TBSCertificate". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_mapper
Patch Set: Fully move expectations to test data Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/data/parse_certificate_unittest/version1.pem
diff --git a/net/data/parse_certificate_unittest/version1.pem b/net/data/parse_certificate_unittest/version1.pem
new file mode 100644
index 0000000000000000000000000000000000000000..04ccabc1836fb7ecc608dec2da63dbf9aa99b1de
--- /dev/null
+++ b/net/data/parse_certificate_unittest/version1.pem
@@ -0,0 +1,234 @@
+$ openssl x509 -inform DER -text -noout < [CERTIFICATE]
+Certificate:
+ Data:
+ Version: 1 (0x0)
+ Serial Number: 10458 (0x28da)
+ Signature Algorithm: md5WithRSAEncryption
+ Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com
+ Validity
+ Not Before: Sep 29 12:33:37 1998 GMT
+ Not After : Sep 29 12:33:37 1999 GMT
+ Subject: C=UK, ST=Devon, L=Shaldon, O=Web Sight Ltd, OU=web operations, CN=www.web-sight.co.uk
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:e4:26:38:1d:18:87:45:ab:36:0b:c8:9a:4f:87:
+ f6:be:8c:34:f2:f6:c7:d2:f3:13:1d:7f:a2:e0:ba:
+ 64:73:d0:48:d7:f8:5d:28:c4:df:ce:13:57:7b:bc:
+ d4:f6:57:ee:72:b3:12:46:21:22:42:3d:df:7f:fd:
+ 13:21:d2:00:3e:a5:c2:27:a9:f3:43:d8:66:29:10:
+ 89:f6:24:3b:59:27:e0:6b:df:ff:5e:3f:93:36:28:
+ 11:b8:80:bf:7c:b3:e0:bf:03:42:c2:21:14:e9:ec:
+ 92:69:6b:53:20:90:3a:f9:2b:16:28:cb:5d:25:51:
+ 2a:31:ae:f7:b5:b5:04:2e:c1
+ Exponent: 65537 (0x10001)
+ Signature Algorithm: md5WithRSAEncryption
+ 8f:a7:4e:a9:7a:29:a3:ec:04:13:a6:31:a9:5b:84:f6:e6:ea:
+ b2:86:2a:94:c6:88:7f:c3:49:38:9e:5c:c3:81:f1:b1:a3:ce:
+ c2:e9:f9:55:2d:79:57:16:99:0f:c5:e9:9e:58:9a:c1:a8:b3:
+ 8d:75:5e:f5:eb:c1:5d:48:59:e9:f4:1b:aa:1e:b4:2e:71:44:
+ 65:d1:ad:43:75:64:52:ec:53:dd:23:9b:31:a9:7d:b1:eb:b8:
+ fd:a7:2f:c4:77:7c:0f:b2:a2:7e:d6:78:4d:32:f1:d2:e7:5a:
+ 08:95:c8:ba:a0:11:32:18:4f:e1:76:41:e8:90:53:51:76:d6:
+ 8a:7d
+
+
+$ openssl asn1parse -i -inform DER < [CERTIFICATE]
+ 0:d=0 hl=4 l= 691 cons: SEQUENCE
+ 4:d=1 hl=4 l= 540 cons: SEQUENCE
+ 8:d=2 hl=2 l= 2 prim: INTEGER :28DA
+ 12:d=2 hl=2 l= 13 cons: SEQUENCE
+ 14:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
+ 25:d=3 hl=2 l= 0 prim: NULL
+ 27:d=2 hl=3 l= 196 cons: SEQUENCE
+ 30:d=3 hl=2 l= 11 cons: SET
+ 32:d=4 hl=2 l= 9 cons: SEQUENCE
+ 34:d=5 hl=2 l= 3 prim: OBJECT :countryName
+ 39:d=5 hl=2 l= 2 prim: PRINTABLESTRING :ZA
+ 43:d=3 hl=2 l= 21 cons: SET
+ 45:d=4 hl=2 l= 19 cons: SEQUENCE
+ 47:d=5 hl=2 l= 3 prim: OBJECT :stateOrProvinceName
+ 52:d=5 hl=2 l= 12 prim: PRINTABLESTRING :Western Cape
+ 66:d=3 hl=2 l= 18 cons: SET
+ 68:d=4 hl=2 l= 16 cons: SEQUENCE
+ 70:d=5 hl=2 l= 3 prim: OBJECT :localityName
+ 75:d=5 hl=2 l= 9 prim: PRINTABLESTRING :Cape Town
+ 86:d=3 hl=2 l= 29 cons: SET
+ 88:d=4 hl=2 l= 27 cons: SEQUENCE
+ 90:d=5 hl=2 l= 3 prim: OBJECT :organizationName
+ 95:d=5 hl=2 l= 20 prim: PRINTABLESTRING :Thawte Consulting cc
+ 117:d=3 hl=2 l= 40 cons: SET
+ 119:d=4 hl=2 l= 38 cons: SEQUENCE
+ 121:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName
+ 126:d=5 hl=2 l= 31 prim: PRINTABLESTRING :Certification Services Division
+ 159:d=3 hl=2 l= 25 cons: SET
+ 161:d=4 hl=2 l= 23 cons: SEQUENCE
+ 163:d=5 hl=2 l= 3 prim: OBJECT :commonName
+ 168:d=5 hl=2 l= 16 prim: PRINTABLESTRING :Thawte Server CA
+ 186:d=3 hl=2 l= 38 cons: SET
+ 188:d=4 hl=2 l= 36 cons: SEQUENCE
+ 190:d=5 hl=2 l= 9 prim: OBJECT :emailAddress
+ 201:d=5 hl=2 l= 23 prim: IA5STRING :server-certs@thawte.com
+ 226:d=2 hl=2 l= 30 cons: SEQUENCE
+ 228:d=3 hl=2 l= 13 prim: UTCTIME :980929123337Z
+ 243:d=3 hl=2 l= 13 prim: UTCTIME :990929123337Z
+ 258:d=2 hl=2 l= 126 cons: SEQUENCE
+ 260:d=3 hl=2 l= 11 cons: SET
+ 262:d=4 hl=2 l= 9 cons: SEQUENCE
+ 264:d=5 hl=2 l= 3 prim: OBJECT :countryName
+ 269:d=5 hl=2 l= 2 prim: PRINTABLESTRING :UK
+ 273:d=3 hl=2 l= 14 cons: SET
+ 275:d=4 hl=2 l= 12 cons: SEQUENCE
+ 277:d=5 hl=2 l= 3 prim: OBJECT :stateOrProvinceName
+ 282:d=5 hl=2 l= 5 prim: PRINTABLESTRING :Devon
+ 289:d=3 hl=2 l= 16 cons: SET
+ 291:d=4 hl=2 l= 14 cons: SEQUENCE
+ 293:d=5 hl=2 l= 3 prim: OBJECT :localityName
+ 298:d=5 hl=2 l= 7 prim: PRINTABLESTRING :Shaldon
+ 307:d=3 hl=2 l= 22 cons: SET
+ 309:d=4 hl=2 l= 20 cons: SEQUENCE
+ 311:d=5 hl=2 l= 3 prim: OBJECT :organizationName
+ 316:d=5 hl=2 l= 13 prim: PRINTABLESTRING :Web Sight Ltd
+ 331:d=3 hl=2 l= 23 cons: SET
+ 333:d=4 hl=2 l= 21 cons: SEQUENCE
+ 335:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName
+ 340:d=5 hl=2 l= 14 prim: PRINTABLESTRING :web operations
+ 356:d=3 hl=2 l= 28 cons: SET
+ 358:d=4 hl=2 l= 26 cons: SEQUENCE
+ 360:d=5 hl=2 l= 3 prim: OBJECT :commonName
+ 365:d=5 hl=2 l= 19 prim: PRINTABLESTRING :www.web-sight.co.uk
+ 386:d=2 hl=3 l= 159 cons: SEQUENCE
+ 389:d=3 hl=2 l= 13 cons: SEQUENCE
+ 391:d=4 hl=2 l= 9 prim: OBJECT :rsaEncryption
+ 402:d=4 hl=2 l= 0 prim: NULL
+ 404:d=3 hl=3 l= 141 prim: BIT STRING
+ 548:d=1 hl=2 l= 13 cons: SEQUENCE
+ 550:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
+ 561:d=2 hl=2 l= 0 prim: NULL
+ 563:d=1 hl=3 l= 129 prim: BIT STRING
+-----BEGIN CERTIFICATE-----
+MIICszCCAhwCAijaMA0GCSqGSIb3DQEBBAUAMIHEMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2V
+zdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xHTAbBgNVBAoTFFRoYXd0ZSBDb25zdWx0aW
+5nIGN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+ 0:d=0 hl=2 l= 13 cons: SEQUENCE
+ 2:d=1 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
+ 13:d=1 hl=2 l= 0 prim: NULL
+-----BEGIN SIGNATURE ALGORITHM-----
+MA0GCSqGSIb3DQEBBAUA
+-----END SIGNATURE ALGORITHM-----
+
+
+-----BEGIN SERIAL NUMBER-----
+KNo=
+-----END SERIAL NUMBER-----
+
+$ openssl asn1parse -i -inform DER < [ISSUER]
+ 0:d=0 hl=3 l= 196 cons: SEQUENCE
+ 3:d=1 hl=2 l= 11 cons: SET
+ 5:d=2 hl=2 l= 9 cons: SEQUENCE
+ 7:d=3 hl=2 l= 3 prim: OBJECT :countryName
+ 12:d=3 hl=2 l= 2 prim: PRINTABLESTRING :ZA
+ 16:d=1 hl=2 l= 21 cons: SET
+ 18:d=2 hl=2 l= 19 cons: SEQUENCE
+ 20:d=3 hl=2 l= 3 prim: OBJECT :stateOrProvinceName
+ 25:d=3 hl=2 l= 12 prim: PRINTABLESTRING :Western Cape
+ 39:d=1 hl=2 l= 18 cons: SET
+ 41:d=2 hl=2 l= 16 cons: SEQUENCE
+ 43:d=3 hl=2 l= 3 prim: OBJECT :localityName
+ 48:d=3 hl=2 l= 9 prim: PRINTABLESTRING :Cape Town
+ 59:d=1 hl=2 l= 29 cons: SET
+ 61:d=2 hl=2 l= 27 cons: SEQUENCE
+ 63:d=3 hl=2 l= 3 prim: OBJECT :organizationName
+ 68:d=3 hl=2 l= 20 prim: PRINTABLESTRING :Thawte Consulting cc
+ 90:d=1 hl=2 l= 40 cons: SET
+ 92:d=2 hl=2 l= 38 cons: SEQUENCE
+ 94:d=3 hl=2 l= 3 prim: OBJECT :organizationalUnitName
+ 99:d=3 hl=2 l= 31 prim: PRINTABLESTRING :Certification Services Division
+ 132:d=1 hl=2 l= 25 cons: SET
+ 134:d=2 hl=2 l= 23 cons: SEQUENCE
+ 136:d=3 hl=2 l= 3 prim: OBJECT :commonName
+ 141:d=3 hl=2 l= 16 prim: PRINTABLESTRING :Thawte Server CA
+ 159:d=1 hl=2 l= 38 cons: SET
+ 161:d=2 hl=2 l= 36 cons: SEQUENCE
+ 163:d=3 hl=2 l= 9 prim: OBJECT :emailAddress
+ 174:d=3 hl=2 l= 23 prim: IA5STRING :server-certs@thawte.com
+-----BEGIN ISSUER-----
+MIHEMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFR
+vd24xHTAbBgNVBAoTFFRoYXd0ZSBDb25zdWx0aW5nIGNjMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW
+9uIFNlcnZpY2VzIERpdmlzaW9uMRkwFwYDVQQDExBUaGF3dGUgU2VydmVyIENBMSYwJAYJKoZIh
+vcNAQkBFhdzZXJ2ZXItY2VydHNAdGhhd3RlLmNvbQ==
+-----END ISSUER-----
+
+$ openssl asn1parse -i -inform DER < [VALIDITY]
+ 0:d=0 hl=2 l= 30 cons: SEQUENCE
+ 2:d=1 hl=2 l= 13 prim: UTCTIME :980929123337Z
+ 17:d=1 hl=2 l= 13 prim: UTCTIME :990929123337Z
+-----BEGIN VALIDITY-----
+MB4XDTk4MDkyOTEyMzMzN1oXDTk5MDkyOTEyMzMzN1o=
+-----END VALIDITY-----
+
+$ openssl asn1parse -i -inform DER < [SUBJECT]
+ 0:d=0 hl=2 l= 126 cons: SEQUENCE
+ 2:d=1 hl=2 l= 11 cons: SET
+ 4:d=2 hl=2 l= 9 cons: SEQUENCE
+ 6:d=3 hl=2 l= 3 prim: OBJECT :countryName
+ 11:d=3 hl=2 l= 2 prim: PRINTABLESTRING :UK
+ 15:d=1 hl=2 l= 14 cons: SET
+ 17:d=2 hl=2 l= 12 cons: SEQUENCE
+ 19:d=3 hl=2 l= 3 prim: OBJECT :stateOrProvinceName
+ 24:d=3 hl=2 l= 5 prim: PRINTABLESTRING :Devon
+ 31:d=1 hl=2 l= 16 cons: SET
+ 33:d=2 hl=2 l= 14 cons: SEQUENCE
+ 35:d=3 hl=2 l= 3 prim: OBJECT :localityName
+ 40:d=3 hl=2 l= 7 prim: PRINTABLESTRING :Shaldon
+ 49:d=1 hl=2 l= 22 cons: SET
+ 51:d=2 hl=2 l= 20 cons: SEQUENCE
+ 53:d=3 hl=2 l= 3 prim: OBJECT :organizationName
+ 58:d=3 hl=2 l= 13 prim: PRINTABLESTRING :Web Sight Ltd
+ 73:d=1 hl=2 l= 23 cons: SET
+ 75:d=2 hl=2 l= 21 cons: SEQUENCE
+ 77:d=3 hl=2 l= 3 prim: OBJECT :organizationalUnitName
+ 82:d=3 hl=2 l= 14 prim: PRINTABLESTRING :web operations
+ 98:d=1 hl=2 l= 28 cons: SET
+ 100:d=2 hl=2 l= 26 cons: SEQUENCE
+ 102:d=3 hl=2 l= 3 prim: OBJECT :commonName
+ 107:d=3 hl=2 l= 19 prim: PRINTABLESTRING :www.web-sight.co.uk
+-----BEGIN SUBJECT-----
+MH4xCzAJBgNVBAYTAlVLMQ4wDAYDVQQIEwVEZXZvbjEQMA4GA1UEBxMHU2hhbGRvbjEWMBQGA1U
+EChMNV2ViIFNpZ2h0IEx0ZDEXMBUGA1UECxMOd2ViIG9wZXJhdGlvbnMxHDAaBgNVBAMTE3d3dy
+53ZWItc2lnaHQuY28udWs=
+-----END SUBJECT-----
+
+$ openssl asn1parse -i -inform DER < [SPKI]
+ 0:d=0 hl=3 l= 159 cons: SEQUENCE
+ 3:d=1 hl=2 l= 13 cons: SEQUENCE
+ 5:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption
+ 16:d=2 hl=2 l= 0 prim: NULL
+ 18:d=1 hl=3 l= 141 prim: BIT STRING
+-----BEGIN SPKI-----
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkJjgdGIdFqzYLyJpPh/a+jDTy9sfS8xMdf6L
+gumRz0EjX+F0oxN/OE1d7vNT2V+5ysxJGISJCPd9//RMh0gA+pcInqfND2GYpEIn2JDtZJ+Br3/
+9eP5M2KBG4gL98s+C/A0LCIRTp7JJpa1MgkDr5KxYoy10lUSoxrve1tQQuwQIDAQAB
+-----END SPKI-----
+

Powered by Google App Engine
This is Rietveld 408576698