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

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

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 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/ssl/ssl_info.h ('k') | net/test/embedded_test_server/embedded_test_server.cc » ('j') | 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>
8
7 #include <string> 9 #include <string>
8 #include <vector> 10 #include <vector>
9 11
10 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
12 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
13 #include "net/cert/ct_serialization.h" 15 #include "net/cert/ct_serialization.h"
14 #include "net/cert/signed_certificate_timestamp.h" 16 #include "net/cert/signed_certificate_timestamp.h"
15 #include "net/cert/signed_tree_head.h" 17 #include "net/cert/signed_tree_head.h"
16 #include "net/cert/x509_certificate.h" 18 #include "net/cert/x509_certificate.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 199
198 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { 200 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {
199 CHECK(sct_ref != NULL); 201 CHECK(sct_ref != NULL);
200 *sct_ref = new SignedCertificateTimestamp(); 202 *sct_ref = new SignedCertificateTimestamp();
201 SignedCertificateTimestamp *const sct(sct_ref->get()); 203 SignedCertificateTimestamp *const sct(sct_ref->get());
202 sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1; 204 sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1;
203 sct->log_id = HexToBytes(kTestKeyId); 205 sct->log_id = HexToBytes(kTestKeyId);
204 // Time the log issued a SCT for this certificate, which is 206 // Time the log issued a SCT for this certificate, which is
205 // Fri Apr 5 10:04:16.089 2013 207 // Fri Apr 5 10:04:16.089 2013
206 sct->timestamp = base::Time::UnixEpoch() + 208 sct->timestamp = base::Time::UnixEpoch() +
207 base::TimeDelta::FromMilliseconds(GG_INT64_C(1365181456089)); 209 base::TimeDelta::FromMilliseconds(INT64_C(1365181456089));
208 sct->extensions.clear(); 210 sct->extensions.clear();
209 211
210 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; 212 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256;
211 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; 213 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA;
212 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData); 214 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData);
213 } 215 }
214 216
215 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { 217 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {
216 CHECK(sct_ref != NULL); 218 CHECK(sct_ref != NULL);
217 *sct_ref = new SignedCertificateTimestamp(); 219 *sct_ref = new SignedCertificateTimestamp();
218 SignedCertificateTimestamp *const sct(sct_ref->get()); 220 SignedCertificateTimestamp *const sct(sct_ref->get());
219 sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1; 221 sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1;
220 sct->log_id = HexToBytes(kTestKeyId); 222 sct->log_id = HexToBytes(kTestKeyId);
221 // Time the log issued a SCT for this Precertificate, which is 223 // Time the log issued a SCT for this Precertificate, which is
222 // Fri Apr 5 10:04:16.275 2013 224 // Fri Apr 5 10:04:16.275 2013
223 sct->timestamp = base::Time::UnixEpoch() + 225 sct->timestamp = base::Time::UnixEpoch() +
224 base::TimeDelta::FromMilliseconds(GG_INT64_C(1365181456275)); 226 base::TimeDelta::FromMilliseconds(INT64_C(1365181456275));
225 sct->extensions.clear(); 227 sct->extensions.clear();
226 228
227 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; 229 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256;
228 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; 230 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA;
229 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); 231 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData);
230 } 232 }
231 233
232 std::string GetDefaultIssuerKeyHash() { 234 std::string GetDefaultIssuerKeyHash() {
233 return HexToBytes(kDefaultIssuerKeyHash); 235 return HexToBytes(kDefaultIssuerKeyHash);
234 } 236 }
(...skipping 28 matching lines...) Expand all
263 memcpy(sth->sha256_root_hash, sha256_root_hash.c_str(), kSthRootHashLength); 265 memcpy(sth->sha256_root_hash, sha256_root_hash.c_str(), kSthRootHashLength);
264 266
265 std::string tree_head_signature = HexToBytes(kSampleSTHTreeHeadSignature); 267 std::string tree_head_signature = HexToBytes(kSampleSTHTreeHeadSignature);
266 base::StringPiece sp(tree_head_signature); 268 base::StringPiece sp(tree_head_signature);
267 DecodeDigitallySigned(&sp, &(sth->signature)); 269 DecodeDigitallySigned(&sp, &(sth->signature));
268 } 270 }
269 271
270 } // namespace ct 272 } // namespace ct
271 273
272 } // namespace net 274 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_info.h ('k') | net/test/embedded_test_server/embedded_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698