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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 | 127 |
128 std::string GetTestPublicKey() { | 128 std::string GetTestPublicKey() { |
129 return HexToBytes(kEcP256PublicKey); | 129 return HexToBytes(kEcP256PublicKey); |
130 } | 130 } |
131 | 131 |
132 std::string GetTestPublicKeyId() { | 132 std::string GetTestPublicKeyId() { |
133 return HexToBytes(kTestKeyId); | 133 return HexToBytes(kTestKeyId); |
134 } | 134 } |
135 | 135 |
136 void GetX509CertSCT(SignedCertificateTimestamp* sct) { | 136 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { |
| 137 CHECK(sct_ref != NULL); |
| 138 *sct_ref = new SignedCertificateTimestamp(); |
| 139 SignedCertificateTimestamp *const sct(sct_ref->get()); |
137 sct->log_id = HexToBytes(kTestKeyId); | 140 sct->log_id = HexToBytes(kTestKeyId); |
138 sct->timestamp = base::Time::UnixEpoch() + | 141 sct->timestamp = base::Time::UnixEpoch() + |
139 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456089)); | 142 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456089)); |
140 sct->extensions.clear(); | 143 sct->extensions.clear(); |
141 | 144 |
142 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; | 145 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; |
143 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; | 146 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; |
144 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData); | 147 sct->signature.signature_data = HexToBytes(kTestSCTSignatureData); |
145 } | 148 } |
146 | 149 |
147 void GetPrecertSCT(SignedCertificateTimestamp* sct) { | 150 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) { |
| 151 CHECK(sct_ref != NULL); |
| 152 *sct_ref = new SignedCertificateTimestamp(); |
| 153 SignedCertificateTimestamp *const sct(sct_ref->get()); |
148 sct->log_id = HexToBytes(kTestKeyId); | 154 sct->log_id = HexToBytes(kTestKeyId); |
149 sct->timestamp = base::Time::UnixEpoch() + | 155 sct->timestamp = base::Time::UnixEpoch() + |
150 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456275)); | 156 base::TimeDelta::FromMilliseconds(GG_UINT64_C(1365181456275)); |
151 sct->extensions.clear(); | 157 sct->extensions.clear(); |
152 | 158 |
153 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; | 159 sct->signature.hash_algorithm = ct::DigitallySigned::HASH_ALGO_SHA256; |
154 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; | 160 sct->signature.signature_algorithm = ct::DigitallySigned::SIG_ALGO_ECDSA; |
155 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); | 161 sct->signature.signature_data = HexToBytes(kTestSCTPrecertSignatureData); |
156 } | 162 } |
157 | 163 |
158 std::string GetDefaultIssuerKeyHash() { | 164 std::string GetDefaultIssuerKeyHash() { |
159 return HexToBytes(kDefaultIssuerKeyHash); | 165 return HexToBytes(kDefaultIssuerKeyHash); |
160 } | 166 } |
161 | 167 |
162 } // namespace ct | 168 } // namespace ct |
163 | 169 |
164 } // namespace net | 170 } // namespace net |
OLD | NEW |