summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/convert_user_script.cc8
-rw-r--r--chrome/browser/extensions/convert_web_app.cc12
-rw-r--r--chrome/browser/extensions/extension_creator.cc24
-rw-r--r--chrome/browser/extensions/extension_creator.h12
-rw-r--r--chrome/browser/extensions/extension_updater.cc8
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.cc4
6 files changed, 34 insertions, 34 deletions
diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc
index 3f89b74..e1f7e79 100644
--- a/chrome/browser/extensions/convert_user_script.cc
+++ b/chrome/browser/extensions/convert_user_script.cc
@@ -12,8 +12,8 @@
#include "base/file_util.h"
#include "base/memory/scoped_temp_dir.h"
#include "base/path_service.h"
-#include "base/sha2.h"
#include "base/string_util.h"
+#include "crypto/sha2.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
@@ -72,10 +72,10 @@ scoped_refptr<Extension> ConvertUserScriptToExtension(
// identity is its namespace+name, so we hash that to create a public key.
// There will be no corresponding private key, which means user scripts cannot
// be auto-updated, or claimed in the gallery.
- char raw[base::SHA256_LENGTH] = {0};
+ char raw[crypto::SHA256_LENGTH] = {0};
std::string key;
- base::SHA256HashString(script_name, raw, base::SHA256_LENGTH);
- base::Base64Encode(std::string(raw, base::SHA256_LENGTH), &key);
+ crypto::SHA256HashString(script_name, raw, crypto::SHA256_LENGTH);
+ base::Base64Encode(std::string(raw, crypto::SHA256_LENGTH), &key);
// The script may not have a name field, but we need one for an extension. If
// it is missing, use the filename of the original URL.
diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc
index 27a0fc9..f3305a7 100644
--- a/chrome/browser/extensions/convert_web_app.cc
+++ b/chrome/browser/extensions/convert_web_app.cc
@@ -15,10 +15,10 @@
#include "base/logging.h"
#include "base/memory/scoped_temp_dir.h"
#include "base/path_service.h"
-#include "base/sha2.h"
#include "base/stringprintf.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
+#include "crypto/sha2.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -46,12 +46,12 @@ const char kIconsDirName[] = "icons";
// auto-updated using ExtensionUpdater. But Chrome does notice updates to the
// manifest and regenerates these extensions.
std::string GenerateKey(const GURL& manifest_url) {
- char raw[base::SHA256_LENGTH] = {0};
+ char raw[crypto::SHA256_LENGTH] = {0};
std::string key;
- base::SHA256HashString(manifest_url.spec().c_str(),
- raw,
- base::SHA256_LENGTH);
- base::Base64Encode(std::string(raw, base::SHA256_LENGTH), &key);
+ crypto::SHA256HashString(manifest_url.spec().c_str(),
+ raw,
+ crypto::SHA256_LENGTH);
+ base::Base64Encode(std::string(raw, crypto::SHA256_LENGTH), &key);
return key;
}
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
index 4aa7d8c..2f4acf1 100644
--- a/chrome/browser/extensions/extension_creator.cc
+++ b/chrome/browser/extensions/extension_creator.cc
@@ -7,12 +7,12 @@
#include <vector>
#include <string>
-#include "base/crypto/rsa_private_key.h"
-#include "base/crypto/signature_creator.h"
#include "base/file_util.h"
#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_temp_dir.h"
#include "base/string_util.h"
+#include "crypto/rsa_private_key.h"
+#include "crypto/signature_creator.h"
#include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_file_util.h"
@@ -74,7 +74,7 @@ bool ExtensionCreator::InitializeInput(
return true;
}
-base::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath&
+crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath&
private_key_path) {
if (!file_util::PathExists(private_key_path)) {
error_message_ =
@@ -98,14 +98,14 @@ base::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath&
return NULL;
}
- return base::RSAPrivateKey::CreateFromPrivateKeyInfo(
+ return crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(
std::vector<uint8>(private_key_bytes.begin(), private_key_bytes.end()));
}
-base::RSAPrivateKey* ExtensionCreator::GenerateKey(const FilePath&
+crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const FilePath&
output_private_key_path) {
- scoped_ptr<base::RSAPrivateKey> key_pair(
- base::RSAPrivateKey::Create(kRSAKeySize));
+ scoped_ptr<crypto::RSAPrivateKey> key_pair(
+ crypto::RSAPrivateKey::Create(kRSAKeySize));
if (!key_pair.get()) {
error_message_ =
l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_GENERATE);
@@ -163,10 +163,10 @@ bool ExtensionCreator::CreateZip(const FilePath& extension_dir,
}
bool ExtensionCreator::SignZip(const FilePath& zip_path,
- base::RSAPrivateKey* private_key,
+ crypto::RSAPrivateKey* private_key,
std::vector<uint8>* signature) {
- scoped_ptr<base::SignatureCreator> signature_creator(
- base::SignatureCreator::Create(private_key));
+ scoped_ptr<crypto::SignatureCreator> signature_creator(
+ crypto::SignatureCreator::Create(private_key));
ScopedStdioHandle zip_handle(file_util::OpenFile(zip_path, "rb"));
size_t buffer_size = 1 << 16;
scoped_array<uint8> buffer(new uint8[buffer_size]);
@@ -186,7 +186,7 @@ bool ExtensionCreator::SignZip(const FilePath& zip_path,
}
bool ExtensionCreator::WriteCRX(const FilePath& zip_path,
- base::RSAPrivateKey* private_key,
+ crypto::RSAPrivateKey* private_key,
const std::vector<uint8>& signature,
const FilePath& crx_path) {
if (file_util::PathExists(crx_path))
@@ -246,7 +246,7 @@ bool ExtensionCreator::Run(const FilePath& extension_dir,
}
// Initialize Key Pair
- scoped_ptr<base::RSAPrivateKey> key_pair;
+ scoped_ptr<crypto::RSAPrivateKey> key_pair;
if (!private_key_path.value().empty())
key_pair.reset(ReadInputKey(private_key_path));
else
diff --git a/chrome/browser/extensions/extension_creator.h b/chrome/browser/extensions/extension_creator.h
index 6235584..0499821 100644
--- a/chrome/browser/extensions/extension_creator.h
+++ b/chrome/browser/extensions/extension_creator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
-namespace base {
+namespace crypto {
class RSAPrivateKey;
}
@@ -45,11 +45,11 @@ class ExtensionCreator {
const FilePath& private_key_output_path);
// Reads private key from |private_key_path|.
- base::RSAPrivateKey* ReadInputKey(const FilePath& private_key_path);
+ crypto::RSAPrivateKey* ReadInputKey(const FilePath& private_key_path);
// Generates a key pair and writes the private key to |private_key_path|
// if provided.
- base::RSAPrivateKey* GenerateKey(const FilePath& private_key_path);
+ crypto::RSAPrivateKey* GenerateKey(const FilePath& private_key_path);
// Creates temporary zip file for the extension.
bool CreateZip(const FilePath& extension_dir, const FilePath& temp_path,
@@ -57,12 +57,12 @@ class ExtensionCreator {
// Signs the temporary zip and returns the signature.
bool SignZip(const FilePath& zip_path,
- base::RSAPrivateKey* private_key,
+ crypto::RSAPrivateKey* private_key,
std::vector<uint8>* signature);
// Export installable .crx to |crx_path|.
bool WriteCRX(const FilePath& zip_path,
- base::RSAPrivateKey* private_key,
+ crypto::RSAPrivateKey* private_key,
const std::vector<uint8>& signature,
const FilePath& crx_path);
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index 5aeeab6..ca05574 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -12,7 +12,6 @@
#include "base/file_util.h"
#include "base/metrics/histogram.h"
#include "base/rand_util.h"
-#include "base/sha2.h"
#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
@@ -20,6 +19,7 @@
#include "base/time.h"
#include "base/threading/thread.h"
#include "base/version.h"
+#include "crypto/sha2.h"
#include "content/common/notification_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
@@ -787,10 +787,10 @@ void ExtensionUpdater::HandleManifestResults(
void ExtensionUpdater::ProcessBlacklist(const std::string& data) {
DCHECK(alive_);
// Verify sha256 hash value.
- char sha256_hash_value[base::SHA256_LENGTH];
- base::SHA256HashString(data, sha256_hash_value, base::SHA256_LENGTH);
+ char sha256_hash_value[crypto::SHA256_LENGTH];
+ crypto::SHA256HashString(data, sha256_hash_value, crypto::SHA256_LENGTH);
std::string hash_in_hex = base::HexEncode(sha256_hash_value,
- base::SHA256_LENGTH);
+ crypto::SHA256_LENGTH);
if (current_extension_fetch_.package_hash != hash_in_hex) {
NOTREACHED() << "Fetched blacklist checksum is not as expected. "
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
index 8aead47..3cb5173 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
@@ -7,7 +7,6 @@
#include <set>
#include "base/base64.h"
-#include "base/crypto/signature_verifier.h"
#include "base/file_util.h"
#include "base/file_util_proxy.h"
#include "base/memory/scoped_handle.h"
@@ -16,6 +15,7 @@
#include "base/path_service.h"
#include "base/task.h"
#include "base/utf_string_conversions.h" // TODO(viettrungluu): delete me.
+#include "crypto/signature_verifier.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -367,7 +367,7 @@ bool SandboxedExtensionUnpacker::ValidateSignature() {
return false;
}
- base::SignatureVerifier verifier;
+ crypto::SignatureVerifier verifier;
if (!verifier.VerifyInit(extension_misc::kSignatureAlgorithm,
sizeof(extension_misc::kSignatureAlgorithm),
&signature.front(),