| OLD | NEW |
| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 std::string GetTestPublicKeyId() { | 199 std::string GetTestPublicKeyId() { |
| 200 return HexToBytes(kTestKeyId); | 200 return HexToBytes(kTestKeyId); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { | 203 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { |
| 204 CHECK(sct_ref != NULL); | 204 CHECK(sct_ref != NULL); |
| 205 *sct_ref = new SignedCertificateTimestamp(); | 205 *sct_ref = new SignedCertificateTimestamp(); |
| 206 SignedCertificateTimestamp *const sct(sct_ref->get()); | 206 SignedCertificateTimestamp *const sct(sct_ref->get()); |
| 207 sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1; | 207 sct->version = ct::SignedCertificateTimestamp::V1; |
| 208 sct->log_id = HexToBytes(kTestKeyId); | 208 sct->log_id = HexToBytes(kTestKeyId); |
| 209 // Time the log issued a SCT for this certificate, which is | 209 // Time the log issued a SCT for this certificate, which is |
| 210 // Fri Apr 5 10:04:16.089 2013 | 210 // Fri Apr 5 10:04:16.089 2013 |
| 211 sct->timestamp = base::Time::UnixEpoch() + | 211 sct->timestamp = base::Time::UnixEpoch() + |
| 212 base::TimeDelta::FromMilliseconds(INT64_C(1365181456089)); | 212 base::TimeDelta::FromMilliseconds(INT64_C(1365181456089)); |
| 213 sct->extensions.clear(); | 213 sct->extensions.clear(); |
| 214 | 214 |
| 215 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; | 215 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; |
| 216 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; | 216 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; |
| 217 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData); | 217 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { | 220 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { |
| 221 CHECK(sct_ref != NULL); | 221 CHECK(sct_ref != NULL); |
| 222 *sct_ref = new SignedCertificateTimestamp(); | 222 *sct_ref = new SignedCertificateTimestamp(); |
| 223 SignedCertificateTimestamp *const sct(sct_ref->get()); | 223 SignedCertificateTimestamp *const sct(sct_ref->get()); |
| 224 sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1; | 224 sct->version = ct::SignedCertificateTimestamp::V1; |
| 225 sct->log_id = HexToBytes(kTestKeyId); | 225 sct->log_id = HexToBytes(kTestKeyId); |
| 226 // Time the log issued a SCT for this Precertificate, which is | 226 // Time the log issued a SCT for this Precertificate, which is |
| 227 // Fri Apr 5 10:04:16.275 2013 | 227 // Fri Apr 5 10:04:16.275 2013 |
| 228 sct->timestamp = base::Time::UnixEpoch() + | 228 sct->timestamp = base::Time::UnixEpoch() + |
| 229 base::TimeDelta::FromMilliseconds(INT64_C(1365181456275)); | 229 base::TimeDelta::FromMilliseconds(INT64_C(1365181456275)); |
| 230 sct->extensions.clear(); | 230 sct->extensions.clear(); |
| 231 | 231 |
| 232 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; | 232 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; |
| 233 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; | 233 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; |
| 234 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); | 234 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 388 |
| 389 bool CheckForSCTOrigin(const ct::CTVerifyResult& result, | 389 bool CheckForSCTOrigin(const ct::CTVerifyResult& result, |
| 390 ct::SignedCertificateTimestamp::Origin origin) { | 390 ct::SignedCertificateTimestamp::Origin origin) { |
| 391 return (result.verified_scts.size() > 0) && | 391 return (result.verified_scts.size() > 0) && |
| 392 (result.verified_scts[0]->origin == origin); | 392 (result.verified_scts[0]->origin == origin); |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace ct | 395 } // namespace ct |
| 396 | 396 |
| 397 } // namespace net | 397 } // namespace net |
| OLD | NEW |