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

Side by Side Diff: extensions/browser/verified_contents.h

Issue 1549643002: Switch to standard integer types in extensions/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean
Patch Set: Created 5 years 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_ 5 #ifndef EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_
6 #define EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_ 6 #define EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_
7 7
8 #include <stdint.h>
9
8 #include <map> 10 #include <map>
9 #include <string> 11 #include <string>
10 #include <vector> 12 #include <vector>
11 13
12 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/macros.h"
13 #include "base/version.h" 16 #include "base/version.h"
14 17
15 namespace extensions { 18 namespace extensions {
16 19
17 // This class encapsulates the data in a "verified_contents.json" file 20 // This class encapsulates the data in a "verified_contents.json" file
18 // generated by the webstore for a .crx file. That data includes a set of 21 // generated by the webstore for a .crx file. That data includes a set of
19 // signed expected hashes of file content which can be used to check for 22 // signed expected hashes of file content which can be used to check for
20 // corruption of extension files on local disk. 23 // corruption of extension files on local disk.
21 class VerifiedContents { 24 class VerifiedContents {
22 public: 25 public:
23 // Note: the public_key must remain valid for the lifetime of this object. 26 // Note: the public_key must remain valid for the lifetime of this object.
24 VerifiedContents(const uint8* public_key, int public_key_size); 27 VerifiedContents(const uint8_t* public_key, int public_key_size);
25 ~VerifiedContents(); 28 ~VerifiedContents();
26 29
27 // Returns true if we successfully parsed the verified_contents.json file at 30 // Returns true if we successfully parsed the verified_contents.json file at
28 // |path| and validated the enclosed signature. The 31 // |path| and validated the enclosed signature. The
29 // |ignore_invalid_signature| argument can be set to make this still succeed 32 // |ignore_invalid_signature| argument can be set to make this still succeed
30 // if the contents of the file were parsed successfully but the signature did 33 // if the contents of the file were parsed successfully but the signature did
31 // not validate. (Use with caution!) 34 // not validate. (Use with caution!)
32 bool InitFrom(const base::FilePath& path, bool ignore_invalid_signature); 35 bool InitFrom(const base::FilePath& path, bool ignore_invalid_signature);
33 36
34 int block_size() const { return block_size_; } 37 int block_size() const { return block_size_; }
(...skipping 18 matching lines...) Expand all
53 56
54 // The |protected_value| and |payload| arguments should be base64url encoded 57 // The |protected_value| and |payload| arguments should be base64url encoded
55 // strings, and |signature_bytes| should be a byte array. See comments in the 58 // strings, and |signature_bytes| should be a byte array. See comments in the
56 // .cc file on GetPayload for where these come from in the overall input 59 // .cc file on GetPayload for where these come from in the overall input
57 // file. 60 // file.
58 bool VerifySignature(const std::string& protected_value, 61 bool VerifySignature(const std::string& protected_value,
59 const std::string& payload, 62 const std::string& payload,
60 const std::string& signature_bytes); 63 const std::string& signature_bytes);
61 64
62 // The public key we should use for signature verification. 65 // The public key we should use for signature verification.
63 const uint8* public_key_; 66 const uint8_t* public_key_;
64 const int public_key_size_; 67 const int public_key_size_;
65 68
66 // Indicates whether the signature was successfully validated or not. 69 // Indicates whether the signature was successfully validated or not.
67 bool valid_signature_; 70 bool valid_signature_;
68 71
69 // The block size used for computing the treehash root hashes. 72 // The block size used for computing the treehash root hashes.
70 int block_size_; 73 int block_size_;
71 74
72 // Information about which extension these signed hashes are for. 75 // Information about which extension these signed hashes are for.
73 std::string extension_id_; 76 std::string extension_id_;
(...skipping 10 matching lines...) Expand all
84 // webstore reject the cases they can statically detect. See crbug.com/29941 87 // webstore reject the cases they can statically detect. See crbug.com/29941
85 typedef std::multimap<base::FilePath::StringType, std::string> RootHashes; 88 typedef std::multimap<base::FilePath::StringType, std::string> RootHashes;
86 RootHashes root_hashes_; 89 RootHashes root_hashes_;
87 90
88 DISALLOW_COPY_AND_ASSIGN(VerifiedContents); 91 DISALLOW_COPY_AND_ASSIGN(VerifiedContents);
89 }; 92 };
90 93
91 } // namespace extensions 94 } // namespace extensions
92 95
93 #endif // EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_ 96 #endif // EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_
OLDNEW
« no previous file with comments | « extensions/browser/value_store/value_store_frontend.cc ('k') | extensions/browser/verified_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698