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

Side by Side Diff: net/test/ct_test_util.cc

Issue 92443002: Extract Certificate Transparency SCTs from stapled OCSP responses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extract_scts
Patch Set: review comments Created 7 years 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 unified diff | Download patch
OLDNEW
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
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 "308201710a0100a082016a3082016606092b060105050730010104820157308201533081bd"
110 "a21604144edfdf5ff9c90ffacfca66e7fbc436bc39ee3fc7180f3230313030313031303630"
111 "3030305a30819130818e3049300906052b0e03021a050004141833a1e6a4f09577cca0e64c"
112 "e7d145ca4b93700904144edfdf5ff9c90ffacfca66e7fbc436bc39ee3fc70210339c60c849"
113 "8a60b67812cad22988e8568000180f32303130303130313036303030305aa011180f323033"
114 "30303130313036303030305aa11b30193017060a2b06010401d67902040501010004060404"
115 "74657374300d06092a864886f70d01010505000381810013069b03ed74d1cb078cbfbf5e9b"
116 "c041867f1e4f8ae03eb49af183359303020a95858927a312fb8e909a0f4c4233cf2efc4427"
117 "c84c6eb50176f35124cffa5f148686f6ebda01f80d4c60b56709f7eab9e9a4e2b4432316fd"
118 "11de240fa3b741a28b432e186040d5af75583eb764b6ab353c09af07ee9fb5f51fdcea725d"
119 "1d665c";
120
121 const char kFakeOCSPResponseCert[] =
122 "3082022930820192a0030201020210339c60c8498a60b67812cad22988e856300d06092a86"
123 "4886f70d01010505003015311330110603550403130a54657374696e67204341301e170d31"
124 "30303130313036303030305a170d3332313230313036303030305a30373112301006035504"
125 "0313093132372e302e302e31310b300906035504061302585831143012060355040a130b54"
126 "657374696e67204f726730819d300d06092a864886f70d010101050003818b003081870281"
127 "8100a71998f2930bfe73d031a87f133d2f378eeeeed52a77e44d0fc9ff6f07ff32cbf3da99"
128 "9de4ed65832afcb0807f98787506539d258a0ce3c2c77967653099a9034a9b115a876c39a8"
129 "c4e4ed4acd0c64095946fb39eeeb47a0704dbb018acf48c3a1c4b895fc409fb4a340a986b1"
130 "afc45519ab9eca47c30185c771c64aa5ecf07d020103a35a3058303a06082b060105050701"
131 "01010100042b3029302706082b06010505073001861b687474703a2f2f3132372e302e302e"
132 "313a34323239362f6f637370301a0603551d200101000410300e300c060a2b06010401d679"
133 "020401300d06092a864886f70d01010505000381810089cf4ad3888f2140f891a25b1e04a8"
134 "e4fd11f0d428eb76a85f95acb763eb289d82e287ac5e09b2bf80ca34e2ecd9866242b8d1dc"
135 "9cc75455e2fd209f7968bd5052cc970129e8d1def772420a1c656b28fd964736645358c159"
136 "a4c59d43bd61d7db9cab8da4de6dc6a59a676f4136fc9983bd53574551abb4d84771145acc"
137 "80c2";
138
139 const char kFakeOCSPExtensionValue[] = "74657374"; // "test"
140
104 } // namespace 141 } // namespace
105 142
106 void GetX509CertLogEntry(LogEntry* entry) { 143 void GetX509CertLogEntry(LogEntry* entry) {
107 entry->type = ct::LogEntry::LOG_ENTRY_TYPE_X509; 144 entry->type = ct::LogEntry::LOG_ENTRY_TYPE_X509;
108 entry->leaf_certificate = HexToBytes(kDefaultDerCert); 145 entry->leaf_certificate = HexToBytes(kDefaultDerCert);
109 } 146 }
110 147
111 std::string GetDerEncodedX509Cert() { return HexToBytes(kDefaultDerCert); } 148 std::string GetDerEncodedX509Cert() { return HexToBytes(kDefaultDerCert); }
112 149
113 void GetPrecertLogEntry(LogEntry* entry) { 150 void GetPrecertLogEntry(LogEntry* entry) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 199
163 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; 200 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256;
164 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; 201 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA;
165 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); 202 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData);
166 } 203 }
167 204
168 std::string GetDefaultIssuerKeyHash() { 205 std::string GetDefaultIssuerKeyHash() {
169 return HexToBytes(kDefaultIssuerKeyHash); 206 return HexToBytes(kDefaultIssuerKeyHash);
170 } 207 }
171 208
209 std::string GetDerEncodedFakeOCSPResponse() {
210 return HexToBytes(kFakeOCSPResponse);
211 }
212
213 std::string GetFakeOCSPExtensionValue() {
214 return HexToBytes(kFakeOCSPExtensionValue);
215 }
216
217 std::string GetDerEncodedFakeOCSPResponseCert() {
218 return HexToBytes(kFakeOCSPResponseCert);
219 }
220
172 } // namespace ct 221 } // namespace ct
173 222
174 } // namespace net 223 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698