Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_ | |
| 6 #define CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_ | |
| 7 | |
| 8 #include <Security/Security.h> | |
| 9 | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/files/file_path.h" | |
| 14 #include "base/mac/scoped_cftyperef.h" | |
| 15 #include "base/memory/ref_counted.h" | |
| 16 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incid ent.h" | |
| 17 | |
| 18 namespace safe_browsing { | |
| 19 | |
| 20 // Wraps the OS X SecStaticCode API, to evaluate a given file object | |
| 21 // with a given code requirement, and produce a list of incident reports | |
| 22 // for files that fail code signature validity checks. | |
| 23 class MacSignatureEvaluator { | |
|
mattm
2015/10/21 02:06:34
There is also a bug about signature checking for d
Greg K
2015/10/27 01:06:18
I talked to Robert. On OS X the notion of "trusted
mattm
2015/10/27 01:28:12
I see. I still think it could be useful, though. W
| |
| 24 public: | |
| 25 explicit MacSignatureEvaluator(const base::FilePath& signed_object_path); | |
| 26 | |
| 27 // The requirement string must be a valid "Code Signing Requirement Language" | |
| 28 // string, which describes the identity of the signer. | |
| 29 MacSignatureEvaluator(const base::FilePath& signed_object_path, | |
| 30 const std::string& requirement); | |
| 31 | |
| 32 ~MacSignatureEvaluator(); | |
| 33 | |
| 34 // Creates the static code object and requirement string, and returns | |
| 35 // true if the object creation succeeds, else false. | |
| 36 bool Initialize(); | |
| 37 | |
| 38 // Evaluate the signature and return a list of any binary integrity incident | |
| 39 // reports. Returns true if and only if the signed code object is valid. | |
| 40 bool PerformEvaluation( | |
| 41 std::vector<ClientIncidentReport_IncidentData_BinaryIntegrityIncident>* | |
| 42 results); | |
| 43 | |
| 44 private: | |
| 45 // The path to the code object on disk. | |
| 46 base::FilePath path_; | |
| 47 | |
| 48 // A Code Signing Requirement string. | |
| 49 std::string requirement_str_; | |
| 50 | |
| 51 // Records whether or not a requirement string was specified. | |
| 52 bool has_requirement_; | |
| 53 | |
| 54 // The static code object constructed from the code object on disk. | |
| 55 base::ScopedCFTypeRef<SecStaticCodeRef> code_; | |
| 56 | |
| 57 // The requirement object constructed from the requirement string. | |
| 58 base::ScopedCFTypeRef<SecRequirementRef> requirement_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(MacSignatureEvaluator); | |
| 61 }; | |
| 62 | |
| 63 } // namespace safe_browsing | |
| 64 | |
| 65 #endif // CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_ | |
| OLD | NEW |