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

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: 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
« net/test/ct_test_util.h ('K') | « 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 scoped_refptr<SignedCertificateTimestamp> ret(
136 sct->timestamp = base::Time::UnixEpoch() + 136 new SignedCertificateTimestamp());
137 ret->log_id = HexToBytes(kTestKeyId);
138 ret->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 ret->extensions.clear();
139 141
140 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; 142 ret->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256;
141 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; 143 ret->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA;
142 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData); 144 ret->signature.signature_data = HexToBytes(kTestSCTSignatureData);
145 sct->swap(ret);
wtc 2013/11/19 01:57:40 I think the "swap" idiom is only used by functions
alcutter 2013/11/19 15:51:34 no problem, done.
143 } 146 }
144 147
145 void GetPrecertSCT(SignedCertificateTimestamp* sct) { 148 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct) {
146 sct->log_id = HexToBytes(kTestKeyId); 149 scoped_refptr<SignedCertificateTimestamp> ret(
147 sct->timestamp = base::Time::UnixEpoch() + 150 new SignedCertificateTimestamp());
151 ret->log_id = HexToBytes(kTestKeyId);
152 ret->timestamp = base::Time::UnixEpoch() +
148 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456275)); 153 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456275));
149 sct->extensions.clear(); 154 ret->extensions.clear();
150 155
151 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; 156 ret->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256;
152 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; 157 ret->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA;
153 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); 158 ret->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData);
159 sct->swap(ret);
154 } 160 }
155 161
156 } // namespace ct 162 } // namespace ct
157 163
158 } // namespace net 164 } // namespace net
OLDNEW
« net/test/ct_test_util.h ('K') | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698