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

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

Issue 2824983002: Rename net::ct::LogEntry to SignedEntryData and clarify the comment. (Closed)
Patch Set: sort forward decls Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 const char kSampleSTHSHA256RootHash[] = 166 const char kSampleSTHSHA256RootHash[] =
167 "726467216167397babca293dca398e4ce6b621b18b9bc42f30c900d1f92ac1e4"; 167 "726467216167397babca293dca398e4ce6b621b18b9bc42f30c900d1f92ac1e4";
168 const char kSampleSTHTreeHeadSignature[] = 168 const char kSampleSTHTreeHeadSignature[] =
169 "0403004730450220365a91a2a88f2b9332f41d8959fa7086da7e6d634b7b089bc9da066426" 169 "0403004730450220365a91a2a88f2b9332f41d8959fa7086da7e6d634b7b089bc9da066426"
170 "6c7a20022100e38464f3c0fd066257b982074f7ac87655e0c8f714768a050b4be9a7b441cb" 170 "6c7a20022100e38464f3c0fd066257b982074f7ac87655e0c8f714768a050b4be9a7b441cb"
171 "d3"; 171 "d3";
172 size_t kSampleSTHTreeSize = 21u; 172 size_t kSampleSTHTreeSize = 21u;
173 173
174 } // namespace 174 } // namespace
175 175
176 void GetX509CertLogEntry(LogEntry* entry) { 176 void GetX509CertSignedEntry(SignedEntryData* entry) {
177 entry->type = ct::LogEntry::LOG_ENTRY_TYPE_X509; 177 entry->type = ct::SignedEntryData::LOG_ENTRY_TYPE_X509;
178 entry->leaf_certificate = HexToBytes(kDefaultDerCert); 178 entry->leaf_certificate = HexToBytes(kDefaultDerCert);
179 } 179 }
180 180
181 void GetX509CertTreeLeaf(MerkleTreeLeaf* tree_leaf) { 181 void GetX509CertTreeLeaf(MerkleTreeLeaf* tree_leaf) {
182 tree_leaf->timestamp = base::Time::FromJsTime(kTestTimestamp); 182 tree_leaf->timestamp = base::Time::FromJsTime(kTestTimestamp);
183 GetX509CertLogEntry(&tree_leaf->log_entry); 183 GetX509CertSignedEntry(&tree_leaf->signed_entry);
184 tree_leaf->extensions = HexToBytes(kDefaultExtensions); 184 tree_leaf->extensions = HexToBytes(kDefaultExtensions);
185 } 185 }
186 186
187 std::string GetDerEncodedX509Cert() { return HexToBytes(kDefaultDerCert); } 187 std::string GetDerEncodedX509Cert() { return HexToBytes(kDefaultDerCert); }
188 188
189 void GetPrecertLogEntry(LogEntry* entry) { 189 void GetPrecertSignedEntry(SignedEntryData* entry) {
190 entry->type = ct::LogEntry::LOG_ENTRY_TYPE_PRECERT; 190 entry->type = ct::SignedEntryData::LOG_ENTRY_TYPE_PRECERT;
191 std::string issuer_hash(HexToBytes(kDefaultIssuerKeyHash)); 191 std::string issuer_hash(HexToBytes(kDefaultIssuerKeyHash));
192 memcpy(entry->issuer_key_hash.data, issuer_hash.data(), issuer_hash.size()); 192 memcpy(entry->issuer_key_hash.data, issuer_hash.data(), issuer_hash.size());
193 entry->tbs_certificate = HexToBytes(kDefaultDerTbsCert); 193 entry->tbs_certificate = HexToBytes(kDefaultDerTbsCert);
194 } 194 }
195 195
196 void GetPrecertTreeLeaf(MerkleTreeLeaf* tree_leaf) { 196 void GetPrecertTreeLeaf(MerkleTreeLeaf* tree_leaf) {
197 tree_leaf->timestamp = base::Time::FromJsTime(kTestTimestamp); 197 tree_leaf->timestamp = base::Time::FromJsTime(kTestTimestamp);
198 GetPrecertLogEntry(&tree_leaf->log_entry); 198 GetPrecertSignedEntry(&tree_leaf->signed_entry);
199 tree_leaf->extensions = HexToBytes(kDefaultExtensions); 199 tree_leaf->extensions = HexToBytes(kDefaultExtensions);
200 } 200 }
201 201
202 std::string GetTestDigitallySigned() { 202 std::string GetTestDigitallySigned() {
203 return HexToBytes(kTestDigitallySigned); 203 return HexToBytes(kTestDigitallySigned);
204 } 204 }
205 205
206 std::string GetTestSignedCertificateTimestamp() { 206 std::string GetTestSignedCertificateTimestamp() {
207 return HexToBytes(kTestSignedCertificateTimestamp); 207 return HexToBytes(kTestSignedCertificateTimestamp);
208 } 208 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 if (sct_and_status.status == SCT_STATUS_OK && 410 if (sct_and_status.status == SCT_STATUS_OK &&
411 sct_and_status.sct->origin == origin) 411 sct_and_status.sct->origin == origin)
412 return true; 412 return true;
413 413
414 return false; 414 return false;
415 } 415 }
416 416
417 } // namespace ct 417 } // namespace ct
418 418
419 } // namespace net 419 } // namespace net
OLDNEW
« no previous file with comments | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698