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 "build/build_config.h" | |
9 | |
10 #if !defined(OS_MACOSX) | |
Mark Mentovai
2015/10/05 15:02:11
Not necessary. The _mac name makes sure that no ot
Greg K
2015/10/07 22:54:29
Done.
| |
11 #error "This file builds on OS X only." | |
12 #endif | |
13 | |
14 #include <Security/Security.h> | |
15 #include <string> | |
Mark Mentovai
2015/10/05 15:02:11
Blank line between C and C++ system headers.
Greg K
2015/10/07 22:54:29
Done.
| |
16 #include <vector> | |
17 | |
18 #include "base/files/file_path.h" | |
19 #include "base/mac/scoped_cftyperef.h" | |
20 #include "base/memory/ref_counted.h" | |
21 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incid ent.h" | |
22 #include "chrome/browser/safe_browsing/incident_reporting/osx_binary_integrity_i ncident.h" | |
23 | |
24 #if __OBJC__ | |
25 @class NSObject; | |
26 #else | |
27 class NSObject; | |
28 #endif | |
29 | |
30 namespace safe_browsing { | |
31 | |
32 class MacSignatureEvaluator { | |
Robert Sesek
2015/10/05 22:19:07
Needs a class-levelc omment.
Greg K
2015/10/07 22:54:29
Done.
| |
33 public: | |
34 explicit MacSignatureEvaluator(const base::FilePath& signed_object_path); | |
35 | |
36 // The requirement string must be a valid "Code Signing Requirement Language" | |
37 // string, which describes the identity of the signer. | |
38 MacSignatureEvaluator(const base::FilePath& signed_object_path, | |
39 const std::string& requirement); | |
40 | |
41 ~MacSignatureEvaluator(); | |
42 | |
43 // This creates the static code object and requirement string, and returns | |
44 // true if the object creation succeeds, else false. | |
45 bool Initialize(); | |
46 | |
47 // Evaluate the signature and return a list of any binary integrity incident | |
48 // reports. Returns true if and only if the signed code object is valid. | |
49 bool PerformEvaluation( | |
50 ClientIncidentReport_IncidentData_OSXBinaryIntegrityIncident* incident); | |
51 | |
52 private: | |
53 // This is the path to the code object on disk. | |
Mark Mentovai
2015/10/05 15:02:11
“This is” on almost everything here (including Ini
Greg K
2015/10/07 22:54:29
Done.
| |
54 base::FilePath path_; | |
55 | |
56 // This is a Code Signing Requirement string. | |
57 std::string requirement_str_; | |
58 | |
59 // Records whether or not a requirement string was specified. | |
60 bool has_requirement_; | |
61 | |
62 // This is the static code object constructed from the code object on disk. | |
63 base::ScopedCFTypeRef<SecStaticCodeRef> code_; | |
64 | |
65 // This is the requirement object constructed from the requirement string. | |
66 base::ScopedCFTypeRef<SecRequirementRef> requirement_; | |
67 | |
68 // Process the NSError information about any files that were altered. | |
69 void report_altered_files( | |
Mark Mentovai
2015/10/05 15:02:11
1. Naming: ReportAlteredFiles(). http://google.git
Greg K
2015/10/07 22:54:29
Done.
| |
70 NSObject* detail, | |
Mark Mentovai
2015/10/05 15:02:11
NSObject* or id?
Greg K
2015/10/07 22:54:29
id<NSObject>
| |
71 ClientIncidentReport_IncidentData_OSXBinaryIntegrityIncident* incident); | |
72 }; | |
Mark Mentovai
2015/10/05 15:02:11
DISALLOW_COPY_AND_ASSIGN
Greg K
2015/10/07 22:54:29
Done.
| |
73 | |
74 } // namespace safe_browsing | |
75 | |
76 #endif // CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_ | |
OLD | NEW |