Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: chrome/browser/safe_browsing/signature_evaluator_mac.h

Issue 1363613004: Implement anonymous, opt-in, collection of OS X binary integrity incidents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove spurious VLOG() Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
grt (UTC plus 2) 2015/11/02 20:20:15 move to .mm file
12
13 #include "base/files/file_path.h"
14 #include "base/mac/scoped_cftyperef.h"
15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h"
17 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incid ent.h"
18
19 namespace safe_browsing {
20
21 // Wraps the OS X SecStaticCode API, to evaluate a given file object
22 // with a given code requirement, and produce a list of incident reports
23 // for files that fail code signature validity checks.
24 class MacSignatureEvaluator {
25 public:
26 explicit MacSignatureEvaluator(const base::FilePath& signed_object_path);
27
28 // The requirement string must be a valid "Code Signing Requirement Language
29 // string, which describes the identity of the signer.
30 MacSignatureEvaluator(const base::FilePath& signed_object_path,
31 const std::string& requirement);
32
33 ~MacSignatureEvaluator();
34
35 // Creates the static code object and requirement string, and returns
36 // true if the object creation succeeds, else false.
37 bool Initialize();
38
39 // Evaluate the signature and return a list of any binary integrity incident
40 // reports. Returns true if and only if the signed code object is valid.
41 bool PerformEvaluation(
42 ClientIncidentReport_IncidentData_BinaryIntegrityIncident* incident);
43
44 // Returns relative path component between a parent and a child.
45 // For example, /foo/bar and /foo/bar/y returns y. Note that
46 // this knows nothing about symlinks. Exposed for testing.
47 static bool GetRelativePathComponent(const base::FilePath& parent,
48 const base::FilePath& child,
49 std::string* out);
50
51 private:
52 // The path to the code object on disk.
53 base::FilePath path_;
54
55 // A Code Signing Requirement string.
56 std::string requirement_str_;
57
58 // Records whether or not a requirement string was specified.
59 bool has_requirement_;
60
61 // The static code object constructed from the code object on disk.
62 base::ScopedCFTypeRef<SecStaticCodeRef> code_;
63
64 // The requirement object constructed from the requirement string.
65 base::ScopedCFTypeRef<SecRequirementRef> requirement_;
66
67 DISALLOW_COPY_AND_ASSIGN(MacSignatureEvaluator);
68 };
69
70 } // namespace safe_browsing
71
72 #endif // CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698