OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/test/ct_test_util.h" | 5 #include "net/test/ct_test_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 "df1c2ec11500945247a96168325ddc5c7959e8f7c6d388fc002e0bbd3f74d764"; | 94 "df1c2ec11500945247a96168325ddc5c7959e8f7c6d388fc002e0bbd3f74d764"; |
95 | 95 |
96 const char kTestSCTSignatureData[] = | 96 const char kTestSCTSignatureData[] = |
97 "30450220606e10ae5c2d5a1b0aed49dc4937f48de71a4e9784e9c208dfbfe9ef536cf7f202" | 97 "30450220606e10ae5c2d5a1b0aed49dc4937f48de71a4e9784e9c208dfbfe9ef536cf7f202" |
98 "2100beb29c72d7d06d61d06bdb38a069469aa86fe12e18bb7cc45689a2c0187ef5a5"; | 98 "2100beb29c72d7d06d61d06bdb38a069469aa86fe12e18bb7cc45689a2c0187ef5a5"; |
99 | 99 |
100 const char kTestSCTPrecertSignatureData[] = | 100 const char kTestSCTPrecertSignatureData[] = |
101 "30450220482f6751af35dba65436be1fd6640f3dbf9a41429495924530288fa3e5e23e0602" | 101 "30450220482f6751af35dba65436be1fd6640f3dbf9a41429495924530288fa3e5e23e0602" |
102 "2100e4edc0db3ac572b1e2f5e8ab6a680653987dcf41027dfeffa105519d89edbf08"; | 102 "2100e4edc0db3ac572b1e2f5e8ab6a680653987dcf41027dfeffa105519d89edbf08"; |
103 | 103 |
| 104 // A well-formed OCSP response with fake SCT contents. Does not come from |
| 105 // http://code.google.com/p/certificate-transparency, does not pertain to any |
| 106 // of the test certs here, and is only used to test extracting the extension |
| 107 // contents from the response. |
| 108 const char kFakeOCSPResponse[] = |
| 109 "3082016e0a0100a08201673082016306092b060105050730010104820154308201503081ba" |
| 110 "a21604144edfdf5ff9c90ffacfca66e7fbc436bc39ee3fc7180f3230313030313031303630" |
| 111 "3030305a30818e30818b3049300906052b0e03021a050004141833a1e6a4f09577cca0e64c" |
| 112 "e7d145ca4b93700904144edfdf5ff9c90ffacfca66e7fbc436bc39ee3fc7021001aef99bde" |
| 113 "e0bb58c6f2b816bc3ae02f8000180f32303130303130313036303030305aa011180f323033" |
| 114 "30303130313036303030305aa11830163014060a2b06010401d67902040504060404746573" |
| 115 "74300d06092a864886f70d0101050500038181003586ffcf0794e64eb643d52a3d570a1c93" |
| 116 "836395986a2f792dd4e9c70b05161186c55c1658e0607dc9ec0d0924ac37fb99506c870579" |
| 117 "634be1de62ba2fced5f61f3b428f959fcee9bddf6f268c8e14c14fdf3b447786e638a5c8cc" |
| 118 "b610893df17a60e4cff30f4780aeffe0086ef19910f0d9cd7414bc93d1945686f88ad0a3c3" |
| 119 ; |
| 120 |
| 121 const char kFakeOCSPResponseCert[] = |
| 122 "3082022930820192a003020102021001aef99bdee0bb58c6f2b816bc3ae02f300d06092a86" |
| 123 "4886f70d01010505003015311330110603550403130a54657374696e67204341301e170d31" |
| 124 "30303130313036303030305a170d3332313230313036303030305a30373112301006035504" |
| 125 "0313093132372e302e302e31310b300906035504061302585831143012060355040a130b54" |
| 126 "657374696e67204f726730819d300d06092a864886f70d010101050003818b003081870281" |
| 127 "8100a71998f2930bfe73d031a87f133d2f378eeeeed52a77e44d0fc9ff6f07ff32cbf3da99" |
| 128 "9de4ed65832afcb0807f98787506539d258a0ce3c2c77967653099a9034a9b115a876c39a8" |
| 129 "c4e4ed4acd0c64095946fb39eeeb47a0704dbb018acf48c3a1c4b895fc409fb4a340a986b1" |
| 130 "afc45519ab9eca47c30185c771c64aa5ecf07d020103a35a3058303a06082b060105050701" |
| 131 "01010100042b3029302706082b06010505073001861b687474703a2f2f3132372e302e302e" |
| 132 "313a35353038312f6f637370301a0603551d200101000410300e300c060a2b06010401d679" |
| 133 "020401300d06092a864886f70d01010505000381810065e04fadd3484197f3412479d917e1" |
| 134 "9d8f7db57b526f2d0e4c046f86cebe643bf568ea0cd6570b228842aa057c6a7c79f209dfcd" |
| 135 "3419a4d93b1ecfb1c0224f33083c7d4da023499fbd00d81d6711ad58ffcf65f1545247fe9d" |
| 136 "83203425fd706b4fc5e797002af3d88151be5901eef56ec30aacdfc404be1bd35865ff1943" |
| 137 "2516"; |
| 138 |
| 139 const char kFakeOCSPResponseIssuerCert[] = |
| 140 "308201d13082013aa003020102020101300d06092a864886f70d0101050500301531133011" |
| 141 "0603550403130a54657374696e67204341301e170d3130303130313036303030305a170d33" |
| 142 "32313230313036303030305a3015311330110603550403130a54657374696e672043413081" |
| 143 "9d300d06092a864886f70d010101050003818b0030818702818100a71998f2930bfe73d031" |
| 144 "a87f133d2f378eeeeed52a77e44d0fc9ff6f07ff32cbf3da999de4ed65832afcb0807f9878" |
| 145 "7506539d258a0ce3c2c77967653099a9034a9b115a876c39a8c4e4ed4acd0c64095946fb39" |
| 146 "eeeb47a0704dbb018acf48c3a1c4b895fc409fb4a340a986b1afc45519ab9eca47c30185c7" |
| 147 "71c64aa5ecf07d020103a333303130120603551d130101ff040830060101ff020100301b06" |
| 148 "03551d200101000411300f300d060b2b06010401d6790201ce0f300d06092a864886f70d01" |
| 149 "01050500038181003f4936f8d00e83fbdde331f2c64335dcf7dec8b1a2597683edeed61af0" |
| 150 "fa862412fad848938fe7ab77f1f9a43671ff6fdb729386e26f49e7aca0c0ea216e5970d933" |
| 151 "3ea1e11df2ccb357a5fed5220f9c6239e8946b9b7517707631d51ab996833d58a022cff5a6" |
| 152 "2169ac9258ec110efee78da9ab4a641e3b3c9ee5e8bd291460"; |
| 153 |
| 154 |
| 155 const char kFakeOCSPExtensionValue[] = "74657374"; // "test" |
| 156 |
104 } // namespace | 157 } // namespace |
105 | 158 |
106 void GetX509CertLogEntry(LogEntry* entry) { | 159 void GetX509CertLogEntry(LogEntry* entry) { |
107 entry->type = ct::LogEntry::LOG_ENTRY_TYPE_X509; | 160 entry->type = ct::LogEntry::LOG_ENTRY_TYPE_X509; |
108 entry->leaf_certificate = HexToBytes(kDefaultDerCert); | 161 entry->leaf_certificate = HexToBytes(kDefaultDerCert); |
109 } | 162 } |
110 | 163 |
111 std::string GetDerEncodedX509Cert() { return HexToBytes(kDefaultDerCert); } | 164 std::string GetDerEncodedX509Cert() { return HexToBytes(kDefaultDerCert); } |
112 | 165 |
113 void GetPrecertLogEntry(LogEntry* entry) { | 166 void GetPrecertLogEntry(LogEntry* entry) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 217 |
165 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; | 218 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; |
166 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; | 219 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; |
167 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); | 220 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); |
168 } | 221 } |
169 | 222 |
170 std::string GetDefaultIssuerKeyHash() { | 223 std::string GetDefaultIssuerKeyHash() { |
171 return HexToBytes(kDefaultIssuerKeyHash); | 224 return HexToBytes(kDefaultIssuerKeyHash); |
172 } | 225 } |
173 | 226 |
| 227 std::string GetDerEncodedFakeOCSPResponse() { |
| 228 return HexToBytes(kFakeOCSPResponse); |
| 229 } |
| 230 |
| 231 std::string GetFakeOCSPExtensionValue() { |
| 232 return HexToBytes(kFakeOCSPExtensionValue); |
| 233 } |
| 234 |
| 235 std::string GetDerEncodedFakeOCSPResponseCert() { |
| 236 return HexToBytes(kFakeOCSPResponseCert); |
| 237 } |
| 238 |
| 239 std::string GetDerEncodedFakeOCSPResponseIssuerCert() { |
| 240 return HexToBytes(kFakeOCSPResponseIssuerCert); |
| 241 } |
| 242 |
174 } // namespace ct | 243 } // namespace ct |
175 | 244 |
176 } // namespace net | 245 } // namespace net |
OLD | NEW |