| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "base/time/time.h" |
| 12 | 13 |
| 13 namespace cast_certificate { | 14 namespace cast_certificate { |
| 14 | 15 |
| 15 namespace testing { | 16 namespace testing { |
| 16 | 17 |
| 17 // Reads a PEM file containing certificates to a vector of their DER data. | 18 // 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 | 19 // |file_name| should be relative to //components/test/data/cast_certificate |
| 19 std::vector<std::string> ReadCertificateChainFromFile( | 20 std::vector<std::string> ReadCertificateChainFromFile( |
| 20 const base::StringPiece& file_name); | 21 const base::StringPiece& file_name); |
| 21 | 22 |
| 22 // Helper structure that describes a message and its various signatures. | 23 // Helper structure that describes a message and its various signatures. |
| 23 struct SignatureTestData { | 24 struct SignatureTestData { |
| 24 std::string message; | 25 std::string message; |
| 25 | 26 |
| 26 // RSASSA PKCS#1 v1.5 with SHA1. | 27 // RSASSA PKCS#1 v1.5 with SHA1. |
| 27 std::string signature_sha1; | 28 std::string signature_sha1; |
| 28 | 29 |
| 29 // RSASSA PKCS#1 v1.5 with SHA256. | 30 // RSASSA PKCS#1 v1.5 with SHA256. |
| 30 std::string signature_sha256; | 31 std::string signature_sha256; |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 // Reads a PEM file that contains "MESSAGE", "SIGNATURE SHA1" and | 34 // Reads a PEM file that contains "MESSAGE", "SIGNATURE SHA1" and |
| 34 // "SIGNATURE SHA256" blocks. | 35 // "SIGNATURE SHA256" blocks. |
| 35 // |file_name| should be relative to //components/test/data/cast_certificate | 36 // |file_name| should be relative to //components/test/data/cast_certificate |
| 36 SignatureTestData ReadSignatureTestData(const base::StringPiece& file_name); | 37 SignatureTestData ReadSignatureTestData(const base::StringPiece& file_name); |
| 37 | 38 |
| 39 // Reads a file containing the Cast CRL. |
| 40 // |file_name| should be relative to //components/test/data/cast_certificate |
| 41 std::string ReadCRLFromFile(const base::StringPiece& file_name); |
| 42 |
| 43 // Create an exploded date. |
| 44 base::Time::Exploded CreateDate(int year, int month, int day); |
| 45 |
| 38 } // namespace testing | 46 } // namespace testing |
| 39 | 47 |
| 40 } // namespace cast_certificate | 48 } // namespace cast_certificate |
| 41 | 49 |
| 42 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ | 50 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_TEST_HELPERS_H_ |
| OLD | NEW |