OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_creator.h" | 5 #include "chrome/browser/extensions/extension_creator.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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const base::FilePath& | 121 crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const base::FilePath& |
122 private_key_path) { | 122 private_key_path) { |
123 if (!base::PathExists(private_key_path)) { | 123 if (!base::PathExists(private_key_path)) { |
124 error_message_ = | 124 error_message_ = |
125 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_NO_EXISTS); | 125 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_NO_EXISTS); |
126 return NULL; | 126 return NULL; |
127 } | 127 } |
128 | 128 |
129 std::string private_key_contents; | 129 std::string private_key_contents; |
130 if (!file_util::ReadFileToString(private_key_path, | 130 if (!base::ReadFileToString(private_key_path, &private_key_contents)) { |
131 &private_key_contents)) { | |
132 error_message_ = | 131 error_message_ = |
133 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_READ); | 132 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_READ); |
134 return NULL; | 133 return NULL; |
135 } | 134 } |
136 | 135 |
137 std::string private_key_bytes; | 136 std::string private_key_bytes; |
138 if (!Extension::ParsePEMKeyBytes(private_key_contents, | 137 if (!Extension::ParsePEMKeyBytes(private_key_contents, |
139 &private_key_bytes)) { | 138 &private_key_bytes)) { |
140 error_message_ = | 139 error_message_ = |
141 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_INVALID); | 140 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_INVALID); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 SignZip(zip_path, key_pair.get(), &signature) && | 323 SignZip(zip_path, key_pair.get(), &signature) && |
325 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { | 324 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { |
326 result = true; | 325 result = true; |
327 } | 326 } |
328 | 327 |
329 base::DeleteFile(zip_path, false); | 328 base::DeleteFile(zip_path, false); |
330 return result; | 329 return result; |
331 } | 330 } |
332 | 331 |
333 } // namespace extensions | 332 } // namespace extensions |
OLD | NEW |