Chromium Code Reviews| 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 NET_TOOLS_CERT_VERIFY_TOOL_CERT_VERIFY_TOOL_UTIL_H_ | 5 #ifndef NET_TOOLS_CERT_VERIFY_TOOL_CERT_VERIFY_TOOL_UTIL_H_ |
| 6 #define NET_TOOLS_CERT_VERIFY_TOOL_CERT_VERIFY_TOOL_UTIL_H_ | 6 #define NET_TOOLS_CERT_VERIFY_TOOL_CERT_VERIFY_TOOL_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // this might indicate which part of the file |der_cert| came from. | 25 // this might indicate which part of the file |der_cert| came from. |
| 26 std::string source_details; | 26 std::string source_details; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Parses |file_path| as a single DER cert or a PEM certificate list. | 29 // Parses |file_path| as a single DER cert or a PEM certificate list. |
| 30 bool ReadCertificatesFromFile(const base::FilePath& file_path, | 30 bool ReadCertificatesFromFile(const base::FilePath& file_path, |
| 31 std::vector<CertInput>* certs); | 31 std::vector<CertInput>* certs); |
| 32 | 32 |
| 33 // Parses |file_path| as a DER cert or PEM chain. If more than one cert is | 33 // Parses |file_path| as a DER cert or PEM chain. If more than one cert is |
| 34 // present, the first will be used as the target certificate and the rest will | 34 // present, the first will be used as the target certificate and the rest will |
| 35 // be used as intermediates. | 35 // be used as intermediates. Returns true on success. Note if the input |
| 36 void ReadChainFromFile(const base::FilePath& file_path, | 36 // contains no certificates then the return value is true however |
| 37 // nothing is written to |target| or |intermediates. | |
|
mattm
2016/09/06 22:10:50
missing |
eroman
2016/09/06 22:32:56
Done.
| |
| 38 bool ReadChainFromFile(const base::FilePath& file_path, | |
| 37 CertInput* target, | 39 CertInput* target, |
| 38 std::vector<CertInput>* intermediates); | 40 std::vector<CertInput>* intermediates); |
| 39 | 41 |
| 40 // Writes a file and prints an error message if it failed. | 42 // Writes a file and prints an error message if it failed. |
| 41 bool WriteToFile(const base::FilePath& file_path, const std::string& data); | 43 bool WriteToFile(const base::FilePath& file_path, const std::string& data); |
| 42 | 44 |
| 43 // Prints an error about the input |cert|. This will include the file the cert | 45 // Prints an error about the input |cert|. This will include the file the cert |
| 44 // was read from, as well as which block in the file if it was a PEM file. | 46 // was read from, as well as which block in the file if it was a PEM file. |
| 45 void PrintCertError(const std::string& error, const CertInput& cert); | 47 void PrintCertError(const std::string& error, const CertInput& cert); |
| 46 | 48 |
| 47 #endif // NET_TOOLS_CERT_VERIFY_TOOL_CERT_VERIFY_TOOL_UTIL_H_ | 49 #endif // NET_TOOLS_CERT_VERIFY_TOOL_CERT_VERIFY_TOOL_UTIL_H_ |
| OLD | NEW |