// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_TEST_TEST_CERTIFICATE_DATA_H_ #define NET_TEST_TEST_CERTIFICATE_DATA_H_ #include <stdint.h> #include "base/strings/cstring_view.h" // This is the SHA1 hash of the SubjectPublicKeyInfo of nist.der. inline constexpr base::cstring_view kNistSPKIHash = …; // Certificates for test data. They're obtained with: // // $ openssl s_client -connect [host]:443 -showcerts > /tmp/host.pem < /dev/null // $ openssl x509 -inform PEM -outform DER < /tmp/host.pem > /tmp/host.der // $ xxd -i /tmp/host.der // // TODO(wtc): move these certificates to data files in the // src/net/data/ssl/certificates directory. // Google's 2009 cert. Lacks a SubjectAltName, but contains www.google.com in // the Subject CN field. inline constexpr unsigned char google_der[] = …; // webkit.org's 2008 cert. Contains a SubjectAltName field with *.webkit.org and // webkit.org. The Subject CN field contains *.webkit.org. inline constexpr unsigned char webkit_der[] = …; // thawte.com 2008 Extended Validation cert. Lacks a SubjectAltName, but // contains www.thawte.com in the Subject CN field. inline constexpr unsigned char thawte_der[] = …; // DER-encoded X.509 DistinguishedNames. // // To output the subject or issuer of a certificate: // // openssl asn1parse -i -inform DER -in <cert> // // The output will contain // SEQUENCE [This is the issuer name] // ... // SEQUENCE [This is the validity period] // UTCTIME (or GENERALTIME) // UTCTIME // SEQUENCE [This is the subject] // ... // // The OFFSET is the first column before the column, e.g. for '21:d=2', the // offset is 21 for the SEQUENCE you're interested in. // The LENGTH is 'hl + l'. // // To generate the table, then use the following for a DER-encoded // certificate: // // xxd -i -s $OFFSET -l $LENGTH <cert> // // For PEM certificates, convert them to DER before, as in: // // openssl x509 -inform PEM -outform DER -in <cert> | // xxd -i -s $OFFSET -l $LENGTH // // 0:d=0 hl=2 l= 95 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 :US // 15:d=1 hl=2 l= 23 cons: SET // 17:d=2 hl=2 l= 21 cons: SEQUENCE // 19:d=3 hl=2 l= 3 prim: OBJECT :organizationName // 24:d=3 hl=2 l= 14 prim: PRINTABLESTRING :VeriSign, Inc. // 40:d=1 hl=2 l= 55 cons: SET // 42:d=2 hl=2 l= 53 cons: SEQUENCE // 44:d=3 hl=2 l= 3 prim: OBJECT :organizationalUnitName // 49:d=3 hl=2 l= 46 prim: PRINTABLESTRING : // Class 1 Public Primary Certification Authority inline constexpr uint8_t VerisignDN[] = …; // 0:d=0 hl=2 l= 125 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 :IL // 15:d=1 hl=2 l= 22 cons: SET // 17:d=2 hl=2 l= 20 cons: SEQUENCE // 19:d=3 hl=2 l= 3 prim: OBJECT :organizationName // 24:d=3 hl=2 l= 13 prim: PRINTABLESTRING :StartCom Ltd. // 39:d=1 hl=2 l= 43 cons: SET // 41:d=2 hl=2 l= 41 cons: SEQUENCE // 43:d=3 hl=2 l= 3 prim: OBJECT :organizationalUnitName // 48:d=3 hl=2 l= 34 prim: PRINTABLESTRING : // Secure Digital Certificate Signing // 84:d=1 hl=2 l= 41 cons: SET // 86:d=2 hl=2 l= 39 cons: SEQUENCE // 88:d=3 hl=2 l= 3 prim: OBJECT :commonName // 93:d=3 hl=2 l= 32 prim: PRINTABLESTRING : // StartCom Certification Authority inline constexpr uint8_t StartComDN[] = …; // 0:d=0 hl=3 l= 174 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 :US // 16:d=1 hl=2 l= 11 cons: SET // 18:d=2 hl=2 l= 9 cons: SEQUENCE // 20:d=3 hl=2 l= 3 prim: OBJECT :stateOrProvinceName // 25:d=3 hl=2 l= 2 prim: PRINTABLESTRING :UT // 29:d=1 hl=2 l= 23 cons: SET // 31:d=2 hl=2 l= 21 cons: SEQUENCE // 33:d=3 hl=2 l= 3 prim: OBJECT :localityName // 38:d=3 hl=2 l= 14 prim: PRINTABLESTRING :Salt Lake City // 54:d=1 hl=2 l= 30 cons: SET // 56:d=2 hl=2 l= 28 cons: SEQUENCE // 58:d=3 hl=2 l= 3 prim: OBJECT :organizationName // 63:d=3 hl=2 l= 21 prim: PRINTABLESTRING :The USERTRUST Network // 86:d=1 hl=2 l= 33 cons: SET // 88:d=2 hl=2 l= 31 cons: SEQUENCE // 90:d=3 hl=2 l= 3 prim: OBJECT :organizationalUnitName // 95:d=3 hl=2 l= 24 prim: PRINTABLESTRING :http://www.usertrust.com //121:d=1 hl=2 l= 54 cons: SET //123:d=2 hl=2 l= 52 cons: SEQUENCE //125:d=3 hl=2 l= 3 prim: OBJECT :commonName //130:d=3 hl=2 l= 45 prim: PRINTABLESTRING : // UTN-USERFirst-Client Authentication and Email inline constexpr uint8_t UserTrustDN[] = …; // 0:d=0 hl=3 l= 190 cons: SEQUENCE // 3:d=1 hl=2 l= 63 cons: SET // 5:d=2 hl=2 l= 61 cons: SEQUENCE // 7:d=3 hl=2 l= 3 prim: OBJECT :commonName // 12:d=3 hl=2 l= 54 prim: UTF8STRING : // TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı // 68:d=1 hl=2 l= 11 cons: SET // 70:d=2 hl=2 l= 9 cons: SEQUENCE // 72:d=3 hl=2 l= 3 prim: OBJECT :countryName // 77:d=3 hl=2 l= 2 prim: PRINTABLESTRING :TR // 81:d=1 hl=2 l= 15 cons: SET // 83:d=2 hl=2 l= 13 cons: SEQUENCE // 85:d=3 hl=2 l= 3 prim: OBJECT :localityName // 90:d=3 hl=2 l= 6 prim: UTF8STRING :Ankara // 98:d=1 hl=2 l= 93 cons: SET //100:d=2 hl=2 l= 91 cons: SEQUENCE //102:d=3 hl=2 l= 3 prim: OBJECT :organizationName //107:d=3 hl=2 l= 84 prim: UTF8STRING : // TÜRKTRUST Bilgi İletişim ve Bilişim Güvenliği Hizmetleri A.Ş. // (c) Kasım 2005 inline constexpr uint8_t TurkTrustDN[] = …; // 33:d=2 hl=3 l= 207 cons: SEQUENCE // 36:d=3 hl=2 l= 11 cons: SET // 38:d=4 hl=2 l= 9 cons: SEQUENCE // 40:d=5 hl=2 l= 3 prim: OBJECT :countryName // 45:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AT // 49:d=3 hl=3 l= 139 cons: SET // 52:d=4 hl=3 l= 136 cons: SEQUENCE // 55:d=5 hl=2 l= 3 prim: OBJECT :organizationName // 60:d=5 hl=3 l= 128 prim: BMPSTRING : // A-Trust Ges. für Sicherheitssysteme im elektr. Datenverkehr GmbH //191:d=3 hl=2 l= 24 cons: SET //193:d=4 hl=2 l= 22 cons: SEQUENCE //195:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName //200:d=5 hl=2 l= 15 prim: PRINTABLESTRING :A-Trust-Qual-01 //217:d=3 hl=2 l= 24 cons: SET //219:d=4 hl=2 l= 22 cons: SEQUENCE //221:d=5 hl=2 l= 3 prim: OBJECT :commonName //226:d=5 hl=2 l= 15 prim: PRINTABLESTRING :A-Trust-Qual-01 inline constexpr uint8_t ATrustQual01DN[] = …; // 34:d=2 hl=3 l= 180 cons: SEQUENCE // 37:d=3 hl=2 l= 20 cons: SET // 39:d=4 hl=2 l= 18 cons: SEQUENCE // 41:d=5 hl=2 l= 3 prim: OBJECT :organizationName // 46:d=5 hl=2 l= 11 prim: PRINTABLESTRING :Entrust.net // 59:d=3 hl=2 l= 64 cons: SET // 61:d=4 hl=2 l= 62 cons: SEQUENCE // 63:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName // 68:d=5 hl=2 l= 55 prim: T61STRING : // www.entrust.net/CPS_2048 incorp. by ref. (limits liab.) //125:d=3 hl=2 l= 37 cons: SET //127:d=4 hl=2 l= 35 cons: SEQUENCE //129:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName //134:d=5 hl=2 l= 28 prim: PRINTABLESTRING : // (c) 1999 Entrust.net Limited //164:d=3 hl=2 l= 51 cons: SET //166:d=4 hl=2 l= 49 cons: SEQUENCE //168:d=5 hl=2 l= 3 prim: OBJECT :commonName //173:d=5 hl=2 l= 42 prim: PRINTABLESTRING : // Entrust.net Certification Authority (2048) inline constexpr uint8_t EntrustDN[] = …; // 46:d=2 hl=2 l= 76 cons: SEQUENCE // 48:d=3 hl=2 l= 11 cons: SET // 50:d=4 hl=2 l= 9 cons: SEQUENCE // 52:d=5 hl=2 l= 3 prim: OBJECT :countryName // 57:d=5 hl=2 l= 2 prim: PRINTABLESTRING :ZA // 61:d=3 hl=2 l= 37 cons: SET // 63:d=4 hl=2 l= 35 cons: SEQUENCE // 65:d=5 hl=2 l= 3 prim: OBJECT :organizationName // 70:d=5 hl=2 l= 28 prim: PRINTABLESTRING : // Thawte Consulting (Pty) Ltd. // 100:d=3 hl=2 l= 22 cons: SET // 102:d=4 hl=2 l= 20 cons: SEQUENCE // 104:d=5 hl=2 l= 3 prim: OBJECT :commonName // 109:d=5 hl=2 l= 13 prim: PRINTABLESTRING :Thawte SGC CA inline constexpr uint8_t ThawteDN[] = …; // 47:d=2 hl=2 l= 108 cons: SEQUENCE // 49:d=3 hl=2 l= 11 cons: SET // 51:d=4 hl=2 l= 9 cons: SEQUENCE // 53:d=5 hl=2 l= 3 prim: OBJECT :countryName // 58:d=5 hl=2 l= 2 prim: PRINTABLESTRING :US // 62:d=3 hl=2 l= 22 cons: SET // 64:d=4 hl=2 l= 20 cons: SEQUENCE // 66:d=5 hl=2 l= 3 prim: OBJECT :stateOrProvinceName // 71:d=5 hl=2 l= 13 prim: PRINTABLESTRING :Massachusetts // 86:d=3 hl=2 l= 46 cons: SET // 88:d=4 hl=2 l= 44 cons: SEQUENCE // 90:d=5 hl=2 l= 3 prim: OBJECT :organizationName // 95:d=5 hl=2 l= 37 prim: PRINTABLESTRING : // Massachusetts Institute of Technology // 134:d=3 hl=2 l= 21 cons: SET // 136:d=4 hl=2 l= 19 cons: SEQUENCE // 138:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName // 143:d=5 hl=2 l= 12 prim: PRINTABLESTRING :Client CA v1 inline constexpr uint8_t MITDN[] = …; #endif // NET_TEST_TEST_CERTIFICATE_DATA_H_