OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ | 5 #ifndef COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ |
6 #define COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ | 6 #define COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "base/time/time.h" |
| 14 #include "net/cert/internal/trust_store_in_memory.h" |
| 15 |
| 16 namespace net { |
| 17 class TrustStoreInMemory; |
| 18 } |
12 | 19 |
13 namespace cast_certificate { | 20 namespace cast_certificate { |
14 | 21 |
15 namespace testing { | 22 namespace testing { |
16 | 23 |
17 // Reads a PEM file containing certificates to a vector of their DER data. | 24 // Reads a PEM file containing certificates to a vector of their DER data. |
18 // |file_name| should be relative to //components/test/data/cast_certificate | 25 // |file_name| should be relative to //components/test/data/cast_certificate |
19 std::vector<std::string> ReadCertificateChainFromFile( | 26 std::vector<std::string> ReadCertificateChainFromFile( |
20 const base::StringPiece& file_name); | 27 const base::StringPiece& file_name); |
21 | 28 |
(...skipping 10 matching lines...) Expand all Loading... |
32 | 39 |
33 // Reads a PEM file that contains "MESSAGE", "SIGNATURE SHA1" and | 40 // Reads a PEM file that contains "MESSAGE", "SIGNATURE SHA1" and |
34 // "SIGNATURE SHA256" blocks. | 41 // "SIGNATURE SHA256" blocks. |
35 // |file_name| should be relative to //components/test/data/cast_certificate | 42 // |file_name| should be relative to //components/test/data/cast_certificate |
36 SignatureTestData ReadSignatureTestData(const base::StringPiece& file_name); | 43 SignatureTestData ReadSignatureTestData(const base::StringPiece& file_name); |
37 | 44 |
38 // Reads a file from the test data directory | 45 // Reads a file from the test data directory |
39 // (//src/components/test/data/cast_certificate) | 46 // (//src/components/test/data/cast_certificate) |
40 std::string ReadTestFileToString(const base::StringPiece& file_name); | 47 std::string ReadTestFileToString(const base::StringPiece& file_name); |
41 | 48 |
| 49 // Creates a trust store using the test roots encoded in the PEM file at |path|. |
| 50 std::unique_ptr<net::TrustStoreInMemory> CreateTrustStoreFromFile( |
| 51 const std::string& path); |
| 52 |
| 53 // Converts uint64_t unix timestamp in seconds to base::Time. |
| 54 base::Time ConvertUnixTimestampSeconds(uint64_t time); |
| 55 |
42 } // namespace testing | 56 } // namespace testing |
43 | 57 |
44 } // namespace cast_certificate | 58 } // namespace cast_certificate |
45 | 59 |
46 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ | 60 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ |
OLD | NEW |