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

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

Issue 72333007: Add an SignedCertificateTimetampStore, making SignedCertificateTimestamp be refcounted to aid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@piecewise
Patch Set: Fixes for wtc. Created 7 years, 1 month 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 <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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 std::string GetTestPublicKey() { 126 std::string GetTestPublicKey() {
127 return HexToBytes(kEcP256PublicKey); 127 return HexToBytes(kEcP256PublicKey);
128 } 128 }
129 129
130 std::string GetTestPublicKeyId() { 130 std::string GetTestPublicKeyId() {
131 return HexToBytes(kTestKeyId); 131 return HexToBytes(kTestKeyId);
132 } 132 }
133 133
134 void GetX509CertSCT(SignedCertificateTimestamp* sct) { 134 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct) {
135 sct->log_id = HexToBytes(kTestKeyId); 135 CHECK(sct != NULL);
agl 2013/11/19 16:12:40 nit: it would also be fine to have the argument be
alcutter 2013/11/19 18:03:48 "My god, it's full of stars." Good idea, done.
136 sct->timestamp = base::Time::UnixEpoch() + 136 *sct = new SignedCertificateTimestamp();
137 (*sct)->log_id = HexToBytes(kTestKeyId);
138 (*sct)->timestamp = base::Time::UnixEpoch() +
137 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456089)); 139 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456089));
138 sct->extensions.clear(); 140 (*sct)->extensions.clear();
139 141
140 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; 142 (*sct)->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256;
141 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; 143 (*sct)->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA;
142 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData); 144 (*sct)->signature.signature_data = HexToBytes(kTestSCTSignatureData);
143 } 145 }
144 146
145 void GetPrecertSCT(SignedCertificateTimestamp* sct) { 147 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct) {
146 sct->log_id = HexToBytes(kTestKeyId); 148 CHECK(sct != NULL);
147 sct->timestamp = base::Time::UnixEpoch() + 149 *sct = new SignedCertificateTimestamp();
150 (*sct)->log_id = HexToBytes(kTestKeyId);
151 (*sct)->timestamp = base::Time::UnixEpoch() +
148 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456275)); 152 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456275));
149 sct->extensions.clear(); 153 (*sct)->extensions.clear();
150 154
151 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; 155 (*sct)->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256;
152 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; 156 (*sct)->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA;
153 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); 157 (*sct)->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData);
154 } 158 }
155 159
156 } // namespace ct 160 } // namespace ct
157 161
158 } // namespace net 162 } // 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