| OLD | NEW |
| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // This returns a pointer to the binary form of an expected sha256 root hash | 49 // This returns a pointer to the binary form of an expected sha256 root hash |
| 50 // for |relative_path| computing using a tree hash algorithm. | 50 // for |relative_path| computing using a tree hash algorithm. |
| 51 const std::string* GetTreeHashRoot(const base::FilePath& relative_path); | 51 const std::string* GetTreeHashRoot(const base::FilePath& relative_path); |
| 52 | 52 |
| 53 // If InitFrom has not been called yet, or was used in "ignore invalid | 53 // If InitFrom has not been called yet, or was used in "ignore invalid |
| 54 // signature" mode, this can return false. | 54 // signature" mode, this can return false. |
| 55 bool valid_signature() { return valid_signature_; } | 55 bool valid_signature() { return valid_signature_; } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(VerifiedContents); | |
| 59 | |
| 60 // Returns the base64url-decoded "payload" field from the json at |path|, if | 58 // Returns the base64url-decoded "payload" field from the json at |path|, if |
| 61 // the signature was valid (or ignore_invalid_signature was set to true). | 59 // the signature was valid (or ignore_invalid_signature was set to true). |
| 62 bool GetPayload(const base::FilePath& path, | 60 bool GetPayload(const base::FilePath& path, |
| 63 std::string* payload, | 61 std::string* payload, |
| 64 bool ignore_invalid_signature); | 62 bool ignore_invalid_signature); |
| 65 | 63 |
| 66 // The |protected_value| and |payload| arguments should be base64url encoded | 64 // The |protected_value| and |payload| arguments should be base64url encoded |
| 67 // strings, and |signature_bytes| should be a byte array. See comments in the | 65 // strings, and |signature_bytes| should be a byte array. See comments in the |
| 68 // .cc file on GetPayload for where these come from in the overall input | 66 // .cc file on GetPayload for where these come from in the overall input |
| 69 // file. | 67 // file. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 80 | 78 |
| 81 // The block size used for computing the treehash root hashes. | 79 // The block size used for computing the treehash root hashes. |
| 82 int block_size_; | 80 int block_size_; |
| 83 | 81 |
| 84 // Information about which extension these signed hashes are for. | 82 // Information about which extension these signed hashes are for. |
| 85 std::string extension_id_; | 83 std::string extension_id_; |
| 86 base::Version version_; | 84 base::Version version_; |
| 87 | 85 |
| 88 // The expected treehash root hashes for each file. | 86 // The expected treehash root hashes for each file. |
| 89 std::map<base::FilePath, std::string> root_hashes_; | 87 std::map<base::FilePath, std::string> root_hashes_; |
| 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(VerifiedContents); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace extensions | 92 } // namespace extensions |
| 93 | 93 |
| 94 #endif // EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_ | 94 #endif // EXTENSIONS_BROWSER_VERIFIED_CONTENTS_H_ |
| OLD | NEW |