Chromium Code Reviews| 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 <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 Loading... | |
| 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 |
| OLD | NEW |