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" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 | 15 |
15 namespace ct { | 16 namespace ct { |
16 | 17 |
| 18 struct CTVerifyResult; |
17 struct DigitallySigned; | 19 struct DigitallySigned; |
18 struct LogEntry; | 20 struct LogEntry; |
19 struct SignedCertificateTimestamp; | |
20 struct SignedTreeHead; | 21 struct SignedTreeHead; |
21 | 22 |
22 // Note: unless specified otherwise, all test data is taken from Certificate | 23 // Note: unless specified otherwise, all test data is taken from Certificate |
23 // Transparency test data repository. | 24 // Transparency test data repository. |
24 | 25 |
25 // Fills |entry| with test data for an X.509 entry. | 26 // Fills |entry| with test data for an X.509 entry. |
26 void GetX509CertLogEntry(LogEntry* entry); | 27 void GetX509CertLogEntry(LogEntry* entry); |
27 | 28 |
28 // Returns a DER-encoded X509 cert. The SCT provided by | 29 // Returns a DER-encoded X509 cert. The SCT provided by |
29 // GetX509CertSCT is signed over this certificate. | 30 // GetX509CertSCT is signed over this certificate. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // the provided parameters. | 85 // the provided parameters. |
85 std::string CreateSignedTreeHeadJsonString(size_t tree_size, | 86 std::string CreateSignedTreeHeadJsonString(size_t tree_size, |
86 int64_t timestamp, | 87 int64_t timestamp, |
87 std::string sha256_root_hash, | 88 std::string sha256_root_hash, |
88 std::string tree_head_signature); | 89 std::string tree_head_signature); |
89 | 90 |
90 // Assembles, and returns, a sample consistency proof in JSON format using | 91 // Assembles, and returns, a sample consistency proof in JSON format using |
91 // the provided raw nodes (i.e. the raw nodes will be base64-encoded). | 92 // the provided raw nodes (i.e. the raw nodes will be base64-encoded). |
92 std::string CreateConsistencyProofJsonString( | 93 std::string CreateConsistencyProofJsonString( |
93 const std::vector<std::string>& raw_nodes); | 94 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 |
94 } // namespace ct | 112 } // namespace ct |
95 | 113 |
96 } // namespace net | 114 } // namespace net |
97 | 115 |
98 #endif // NET_CERT_CT_TEST_UTIL_H_ | 116 #endif // NET_CERT_CT_TEST_UTIL_H_ |
OLD | NEW |