summaryrefslogtreecommitdiffstats
path: root/chrome/browser/password_manager
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 17:37:14 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 17:37:14 +0000
commit4b559b4ddffc0b7f688019bcb80658f05e063af7 (patch)
tree0be21d8914de707f5125d2cb66733cbcf088606c /chrome/browser/password_manager
parent056dd45d610de34312344445d7b078a31f4a1e20 (diff)
downloadchromium_src-4b559b4ddffc0b7f688019bcb80658f05e063af7.zip
chromium_src-4b559b4ddffc0b7f688019bcb80658f05e063af7.tar.gz
chromium_src-4b559b4ddffc0b7f688019bcb80658f05e063af7.tar.bz2
Move crypto files out of base, to a top level directory.
src/crypto is now an independent project that contains our cryptographic primitives (except md5 and sha1). This removes the base dependency from nss, openssl and sqlite. BUG=76996 TEST=none Review URL: http://codereview.chromium.org/6805019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
-rw-r--r--chrome/browser/password_manager/encryptor_linux.cc30
-rw-r--r--chrome/browser/password_manager/encryptor_mac.mm30
2 files changed, 30 insertions, 30 deletions
diff --git a/chrome/browser/password_manager/encryptor_linux.cc b/chrome/browser/password_manager/encryptor_linux.cc
index 5da8fd8..9cdbb10 100644
--- a/chrome/browser/password_manager/encryptor_linux.cc
+++ b/chrome/browser/password_manager/encryptor_linux.cc
@@ -4,11 +4,11 @@
#include "chrome/browser/password_manager/encryptor.h"
-#include "base/crypto/encryptor.h"
-#include "base/crypto/symmetric_key.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
+#include "crypto/encryptor.h"
+#include "crypto/symmetric_key.h"
namespace {
@@ -32,7 +32,7 @@ const char kObfuscationPrefix[] = "v10";
// Generates a newly allocated SymmetricKey object based a hard-coded password.
// Ownership of the key is passed to the caller. Returns NULL key if a key
// generation error occurs.
-base::SymmetricKey* GetEncryptionKey() {
+crypto::SymmetricKey* GetEncryptionKey() {
// We currently "obfuscate" by encrypting and decrypting with hard-coded
// password. We need to improve this password situation by moving a secure
// password into a system-level key store.
@@ -41,12 +41,12 @@ base::SymmetricKey* GetEncryptionKey() {
std::string salt(kSalt);
// Create an encryption key from our password and salt.
- scoped_ptr<base::SymmetricKey> encryption_key(
- base::SymmetricKey::DeriveKeyFromPassword(base::SymmetricKey::AES,
- password,
- salt,
- kEncryptionIterations,
- kDerivedKeySizeInBits));
+ scoped_ptr<crypto::SymmetricKey> encryption_key(
+ crypto::SymmetricKey::DeriveKeyFromPassword(crypto::SymmetricKey::AES,
+ password,
+ salt,
+ kEncryptionIterations,
+ kDerivedKeySizeInBits));
DCHECK(encryption_key.get());
return encryption_key.release();
@@ -81,13 +81,13 @@ bool Encryptor::EncryptString(const std::string& plaintext,
return true;
}
- scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey());
+ scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey());
if (!encryption_key.get())
return false;
std::string iv(kIVBlockSizeAES128, ' ');
- base::Encryptor encryptor;
- if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv))
+ crypto::Encryptor encryptor;
+ if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv))
return false;
if (!encryptor.Encrypt(plaintext, ciphertext))
@@ -123,13 +123,13 @@ bool Encryptor::DecryptString(const std::string& ciphertext,
// Strip off the versioning prefix before decrypting.
std::string raw_ciphertext = ciphertext.substr(strlen(kObfuscationPrefix));
- scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey());
+ scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey());
if (!encryption_key.get())
return false;
std::string iv(kIVBlockSizeAES128, ' ');
- base::Encryptor encryptor;
- if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv))
+ crypto::Encryptor encryptor;
+ if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv))
return false;
if (!encryptor.Decrypt(raw_ciphertext, plaintext))
diff --git a/chrome/browser/password_manager/encryptor_mac.mm b/chrome/browser/password_manager/encryptor_mac.mm
index a2d9f1c..56b048c 100644
--- a/chrome/browser/password_manager/encryptor_mac.mm
+++ b/chrome/browser/password_manager/encryptor_mac.mm
@@ -6,11 +6,11 @@
#include <CommonCrypto/CommonCryptor.h> // for kCCBlockSizeAES128
-#include "base/crypto/encryptor.h"
-#include "base/crypto/symmetric_key.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
+#include "crypto/encryptor.h"
+#include "crypto/symmetric_key.h"
#include "chrome/browser/password_manager/encryptor_password_mac.h"
#include "chrome/browser/keychain_mac.h"
@@ -37,7 +37,7 @@ const char kEncryptionVersionPrefix[] = "v10";
// in the Keychain. The generated key is for AES encryption. Ownership of the
// key is passed to the caller. Returns NULL key in the case password access
// is denied or key generation error occurs.
-base::SymmetricKey* GetEncryptionKey() {
+crypto::SymmetricKey* GetEncryptionKey() {
std::string password;
if (use_mock_keychain) {
@@ -54,12 +54,12 @@ base::SymmetricKey* GetEncryptionKey() {
std::string salt(kSalt);
// Create an encryption key from our password and salt.
- scoped_ptr<base::SymmetricKey> encryption_key(
- base::SymmetricKey::DeriveKeyFromPassword(base::SymmetricKey::AES,
- password,
- salt,
- kEncryptionIterations,
- kDerivedKeySizeInBits));
+ scoped_ptr<crypto::SymmetricKey> encryption_key(
+ crypto::SymmetricKey::DeriveKeyFromPassword(crypto::SymmetricKey::AES,
+ password,
+ salt,
+ kEncryptionIterations,
+ kDerivedKeySizeInBits));
DCHECK(encryption_key.get());
return encryption_key.release();
@@ -89,13 +89,13 @@ bool Encryptor::EncryptString(const std::string& plaintext,
return true;
}
- scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey());
+ scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey());
if (!encryption_key.get())
return false;
std::string iv(kCCBlockSizeAES128, ' ');
- base::Encryptor encryptor;
- if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv))
+ crypto::Encryptor encryptor;
+ if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv))
return false;
if (!encryptor.Encrypt(plaintext, ciphertext))
@@ -127,13 +127,13 @@ bool Encryptor::DecryptString(const std::string& ciphertext,
std::string raw_ciphertext =
ciphertext.substr(strlen(kEncryptionVersionPrefix));
- scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey());
+ scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey());
if (!encryption_key.get())
return false;
std::string iv(kCCBlockSizeAES128, ' ');
- base::Encryptor encryptor;
- if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv))
+ crypto::Encryptor encryptor;
+ if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv))
return false;
if (!encryptor.Decrypt(raw_ciphertext, plaintext))