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

Unified 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: Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/signature_evaluator_mac.h
diff --git a/chrome/browser/safe_browsing/signature_evaluator_mac.h b/chrome/browser/safe_browsing/signature_evaluator_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..3091e192b4725ab0964fb7549f5d795f4cb03285
--- /dev/null
+++ b/chrome/browser/safe_browsing/signature_evaluator_mac.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_
+#define CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_
+
+#include <Security/Security.h>
+
+#include <string>
+#include <vector>
+
+#include "base/files/file_path.h"
+#include "base/mac/scoped_cftyperef.h"
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incident.h"
+
+namespace safe_browsing {
+
+// Wraps the OS X SecStaticCode API, to evaluate a given file object
+// with a given code requirement, and produce a list of incident reports
+// for files that fail code signature validity checks.
+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
+ public:
+ explicit MacSignatureEvaluator(const base::FilePath& signed_object_path);
+
+ // The requirement string must be a valid "Code Signing Requirement Language"
+ // string, which describes the identity of the signer.
+ MacSignatureEvaluator(const base::FilePath& signed_object_path,
+ const std::string& requirement);
+
+ ~MacSignatureEvaluator();
+
+ // Creates the static code object and requirement string, and returns
+ // true if the object creation succeeds, else false.
+ bool Initialize();
+
+ // Evaluate the signature and return a list of any binary integrity incident
+ // reports. Returns true if and only if the signed code object is valid.
+ bool PerformEvaluation(
+ std::vector<ClientIncidentReport_IncidentData_BinaryIntegrityIncident>*
+ results);
+
+ private:
+ // The path to the code object on disk.
+ base::FilePath path_;
+
+ // A Code Signing Requirement string.
+ std::string requirement_str_;
+
+ // Records whether or not a requirement string was specified.
+ bool has_requirement_;
+
+ // The static code object constructed from the code object on disk.
+ base::ScopedCFTypeRef<SecStaticCodeRef> code_;
+
+ // The requirement object constructed from the requirement string.
+ base::ScopedCFTypeRef<SecRequirementRef> requirement_;
+
+ DISALLOW_COPY_AND_ASSIGN(MacSignatureEvaluator);
+};
+
+} // namespace safe_browsing
+
+#endif // CHROME_COMMON_SAFE_BROWSING_SIGNATURE_EVALUATOR_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698