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 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 |
OLD | NEW |