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