1 // Copyright 2014 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.
5 // Utility functions to extract file features for malicious binary detection.
6 // Each platform has its own implementation of this class.
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
18 namespace safe_browsing
{
19 class ClientDownloadRequest_Digests
;
20 class ClientDownloadRequest_ImageHeaders
;
21 class ClientDownloadRequest_SignatureInfo
;
23 class BinaryFeatureExtractor
24 : public base::RefCountedThreadSafe
<BinaryFeatureExtractor
> {
26 BinaryFeatureExtractor();
28 // Fills in the DownloadRequest_SignatureInfo for the given file path.
29 // This method may be called on any thread.
30 virtual void CheckSignature(
31 const base::FilePath
& file_path
,
32 ClientDownloadRequest_SignatureInfo
* signature_info
);
34 // Populates |image_headers| with the PE image headers of |file_path|.
35 virtual void ExtractImageHeaders(
36 const base::FilePath
& file_path
,
37 ClientDownloadRequest_ImageHeaders
* image_headers
);
39 // Populates |digests.sha256| with the SHA256 digest of |file_path|.
40 virtual void ExtractDigest(const base::FilePath
& file_path
,
41 ClientDownloadRequest_Digests
* digests
);
44 friend class base::RefCountedThreadSafe
<BinaryFeatureExtractor
>;
45 virtual ~BinaryFeatureExtractor();
48 DISALLOW_COPY_AND_ASSIGN(BinaryFeatureExtractor
);
50 } // namespace safe_browsing
52 #endif // CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_