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

Unified Diff: chrome/browser/safe_browsing/signature_util_win.cc

Issue 8345033: Collect some histograms about signed binary downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix chromeos and valgrind Created 9 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_util_win.cc
diff --git a/chrome/browser/safe_browsing/signature_util_win.cc b/chrome/browser/safe_browsing/signature_util_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b7ae87551321c8f5516481aafd0b36baa39d2f7c
--- /dev/null
+++ b/chrome/browser/safe_browsing/signature_util_win.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/safe_browsing/signature_util.h"
+
+#include <windows.h>
+#include <wincrypt.h>
+#include "base/file_path.h"
+
+namespace safe_browsing {
+namespace signature_util {
+
+bool IsSigned(const FilePath& file_path) {
+ // Get message handle and store handle from the signed file.
+ BOOL result = CryptQueryObject(CERT_QUERY_OBJECT_FILE,
+ file_path.value().c_str(),
+ CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED,
+ CERT_QUERY_FORMAT_FLAG_BINARY,
+ 0, // flags
+ NULL, // encoding
+ NULL, // content type
+ NULL, // format type
+ NULL, // HCERTSTORE
+ NULL, // HCRYPTMSG
+ NULL); // context
+ return result == TRUE;
+}
+
+} // namespace signature_util
+} // namespace safe_browsing
« no previous file with comments | « chrome/browser/safe_browsing/signature_util_posix.cc ('k') | chrome/browser/safe_browsing/signature_util_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698