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 #ifndef NET_CERT_CT_TEST_UTIL_H_ | 5 #ifndef NET_CERT_CT_TEST_UTIL_H_ |
6 #define NET_CERT_CT_TEST_UTIL_H_ | 6 #define NET_CERT_CT_TEST_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "net/cert/signed_certificate_timestamp.h" | |
13 | 12 |
14 namespace net { | 13 namespace net { |
15 | 14 |
16 namespace ct { | 15 namespace ct { |
17 | 16 |
18 struct CTVerifyResult; | |
19 struct DigitallySigned; | 17 struct DigitallySigned; |
20 struct LogEntry; | 18 struct LogEntry; |
| 19 struct SignedCertificateTimestamp; |
21 struct SignedTreeHead; | 20 struct SignedTreeHead; |
22 | 21 |
23 // Note: unless specified otherwise, all test data is taken from Certificate | 22 // Note: unless specified otherwise, all test data is taken from Certificate |
24 // Transparency test data repository. | 23 // Transparency test data repository. |
25 | 24 |
26 // Fills |entry| with test data for an X.509 entry. | 25 // Fills |entry| with test data for an X.509 entry. |
27 void GetX509CertLogEntry(LogEntry* entry); | 26 void GetX509CertLogEntry(LogEntry* entry); |
28 | 27 |
29 // Returns a DER-encoded X509 cert. The SCT provided by | 28 // Returns a DER-encoded X509 cert. The SCT provided by |
30 // GetX509CertSCT is signed over this certificate. | 29 // GetX509CertSCT is signed over this certificate. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // the provided parameters. | 84 // the provided parameters. |
86 std::string CreateSignedTreeHeadJsonString(size_t tree_size, | 85 std::string CreateSignedTreeHeadJsonString(size_t tree_size, |
87 int64_t timestamp, | 86 int64_t timestamp, |
88 std::string sha256_root_hash, | 87 std::string sha256_root_hash, |
89 std::string tree_head_signature); | 88 std::string tree_head_signature); |
90 | 89 |
91 // Assembles, and returns, a sample consistency proof in JSON format using | 90 // Assembles, and returns, a sample consistency proof in JSON format using |
92 // the provided raw nodes (i.e. the raw nodes will be base64-encoded). | 91 // the provided raw nodes (i.e. the raw nodes will be base64-encoded). |
93 std::string CreateConsistencyProofJsonString( | 92 std::string CreateConsistencyProofJsonString( |
94 const std::vector<std::string>& raw_nodes); | 93 const std::vector<std::string>& raw_nodes); |
95 | |
96 // Returns SCTList for testing. | |
97 std::string GetSCTListForTesting(); | |
98 | |
99 // Returns a corrupted SCTList. This is done by changing a byte inside the | |
100 // Log ID part of the SCT so it does not match the log used in the tests. | |
101 std::string GetSCTListWithInvalidSCT(); | |
102 | |
103 // Returns true if |log_description| is in the |result|'s |verified_scts| and | |
104 // number of |verified_scts| in |result| is equal to 1. | |
105 bool CheckForSingleVerifiedSCTInResult(const CTVerifyResult& result, | |
106 const std::string& log_description); | |
107 | |
108 // Returns true if |origin| is in the |result|'s |verified_scts|. | |
109 bool CheckForSCTOrigin(const CTVerifyResult& result, | |
110 SignedCertificateTimestamp::Origin origin); | |
111 | |
112 } // namespace ct | 94 } // namespace ct |
113 | 95 |
114 } // namespace net | 96 } // namespace net |
115 | 97 |
116 #endif // NET_CERT_CT_TEST_UTIL_H_ | 98 #endif // NET_CERT_CT_TEST_UTIL_H_ |
OLD | NEW |