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 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" | 5 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace { | 22 namespace { |
23 const base::FilePath::CharType kCompressedEVWhitelistFileName[] = | 23 const base::FilePath::CharType kCompressedEVWhitelistFileName[] = |
24 FILE_PATH_LITERAL("ev_hashes_whitelist.bin"); | 24 FILE_PATH_LITERAL("ev_hashes_whitelist.bin"); |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 namespace component_updater { | 27 namespace component_updater { |
28 | 28 |
29 // The SHA256 of the SubjectPublicKeyInfo used to sign the extension. | 29 // The SHA256 of the SubjectPublicKeyInfo used to sign the extension. |
30 // The extension id is: oafdbfcohdcjandcenmccfopbeklnicp | 30 // The extension id is: oafdbfcohdcjandcenmccfopbeklnicp |
31 const uint8 kPublicKeySHA256[32] = { | 31 const uint8_t kPublicKeySHA256[32] = { |
32 0xe0, 0x53, 0x15, 0x2e, 0x73, 0x29, 0x0d, 0x32, 0x4d, 0xc2, 0x25, | 32 0xe0, 0x53, 0x15, 0x2e, 0x73, 0x29, 0x0d, 0x32, 0x4d, 0xc2, 0x25, |
33 0xef, 0x14, 0xab, 0xd8, 0x2f, 0x84, 0xf5, 0x85, 0x9e, 0xc0, 0xfa, | 33 0xef, 0x14, 0xab, 0xd8, 0x2f, 0x84, 0xf5, 0x85, 0x9e, 0xc0, 0xfa, |
34 0x94, 0xbc, 0x99, 0xc9, 0x5a, 0x27, 0x55, 0x19, 0x83, 0xef}; | 34 0x94, 0xbc, 0x99, 0xc9, 0x5a, 0x27, 0x55, 0x19, 0x83, 0xef}; |
35 | 35 |
36 const char kEVWhitelistManifestName[] = "EV Certs CT whitelist"; | 36 const char kEVWhitelistManifestName[] = "EV Certs CT whitelist"; |
37 | 37 |
38 EVWhitelistComponentInstallerTraits::EVWhitelistComponentInstallerTraits() { | 38 EVWhitelistComponentInstallerTraits::EVWhitelistComponentInstallerTraits() { |
39 } | 39 } |
40 | 40 |
41 bool EVWhitelistComponentInstallerTraits::CanAutoUpdate() const { | 41 bool EVWhitelistComponentInstallerTraits::CanAutoUpdate() const { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return !compressed_whitelist.empty(); | 97 return !compressed_whitelist.empty(); |
98 } | 98 } |
99 | 99 |
100 base::FilePath EVWhitelistComponentInstallerTraits::GetBaseDirectory() const { | 100 base::FilePath EVWhitelistComponentInstallerTraits::GetBaseDirectory() const { |
101 base::FilePath result; | 101 base::FilePath result; |
102 PathService::Get(DIR_COMPONENT_EV_WHITELIST, &result); | 102 PathService::Get(DIR_COMPONENT_EV_WHITELIST, &result); |
103 return result; | 103 return result; |
104 } | 104 } |
105 | 105 |
106 void EVWhitelistComponentInstallerTraits::GetHash( | 106 void EVWhitelistComponentInstallerTraits::GetHash( |
107 std::vector<uint8>* hash) const { | 107 std::vector<uint8_t>* hash) const { |
108 hash->assign(kPublicKeySHA256, | 108 hash->assign(kPublicKeySHA256, |
109 kPublicKeySHA256 + arraysize(kPublicKeySHA256)); | 109 kPublicKeySHA256 + arraysize(kPublicKeySHA256)); |
110 } | 110 } |
111 | 111 |
112 std::string EVWhitelistComponentInstallerTraits::GetName() const { | 112 std::string EVWhitelistComponentInstallerTraits::GetName() const { |
113 return kEVWhitelistManifestName; | 113 return kEVWhitelistManifestName; |
114 } | 114 } |
115 | 115 |
116 void RegisterEVWhitelistComponent(ComponentUpdateService* cus) { | 116 void RegisterEVWhitelistComponent(ComponentUpdateService* cus) { |
117 VLOG(1) << "Registering EV whitelist component."; | 117 VLOG(1) << "Registering EV whitelist component."; |
118 | 118 |
119 scoped_ptr<ComponentInstallerTraits> traits( | 119 scoped_ptr<ComponentInstallerTraits> traits( |
120 new EVWhitelistComponentInstallerTraits()); | 120 new EVWhitelistComponentInstallerTraits()); |
121 // |cus| will take ownership of |installer| during installer->Register(cus). | 121 // |cus| will take ownership of |installer| during installer->Register(cus). |
122 DefaultComponentInstaller* installer = | 122 DefaultComponentInstaller* installer = |
123 new DefaultComponentInstaller(traits.Pass()); | 123 new DefaultComponentInstaller(traits.Pass()); |
124 installer->Register(cus); | 124 installer->Register(cus); |
125 } | 125 } |
126 | 126 |
127 } // namespace component_updater | 127 } // namespace component_updater |
OLD | NEW |