summaryrefslogtreecommitdiffstats
path: root/chrome/browser/password_manager
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 17:47:35 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 17:47:35 +0000
commit109ca1cf9b29865a0f99dc99f379784dc980ac46 (patch)
tree4c16d6b37502c63e06a39cebe065b48c26ced764 /chrome/browser/password_manager
parent15a9b5d62a88c344af81ca28a393dc5c954162c6 (diff)
downloadchromium_src-109ca1cf9b29865a0f99dc99f379784dc980ac46.zip
chromium_src-109ca1cf9b29865a0f99dc99f379784dc980ac46.tar.gz
chromium_src-109ca1cf9b29865a0f99dc99f379784dc980ac46.tar.bz2
Add dummy encryptor implementations for mac and linux.
Review URL: http://codereview.chromium.org/43095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
-rw-r--r--chrome/browser/password_manager/encryptor_linux.cc44
-rw-r--r--chrome/browser/password_manager/encryptor_mac.mm42
-rw-r--r--chrome/browser/password_manager/encryptor_win.cc (renamed from chrome/browser/password_manager/encryptor.cc)4
3 files changed, 88 insertions, 2 deletions
diff --git a/chrome/browser/password_manager/encryptor_linux.cc b/chrome/browser/password_manager/encryptor_linux.cc
new file mode 100644
index 0000000..9c40c37
--- /dev/null
+++ b/chrome/browser/password_manager/encryptor_linux.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2006-2008 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.
+
+#include "chrome/browser/password_manager/encryptor.h"
+
+#include "base/logging.h"
+#include "base/string_util.h"
+
+bool Encryptor::EncryptString16(const string16& plaintext,
+ std::string* ciphertext) {
+ return EncryptString(UTF16ToUTF8(plaintext), ciphertext);
+}
+
+bool Encryptor::DecryptString16(const std::string& ciphertext,
+ string16* plaintext) {
+ std::string utf8;
+ if (!DecryptString(ciphertext, &utf8))
+ return false;
+
+ *plaintext = UTF8ToUTF16(utf8);
+ return true;
+}
+
+bool Encryptor::EncryptString(const std::string& plaintext,
+ std::string* ciphertext) {
+ // This doesn't actually encrypt, we need to work on the Encryptor API.
+ // http://code.google.com/p/chromium/issues/detail?id=8205
+ NOTIMPLEMENTED();
+
+ // this does a copy
+ ciphertext->assign(plaintext.data(), plaintext.length());
+ return true;
+}
+
+bool Encryptor::DecryptString(const std::string& ciphertext,
+ std::string* plaintext) {
+ // This doesn't actually decrypt, we need to work on the Encryptor API.
+ // http://code.google.com/p/chromium/issues/detail?id=8205
+ NOTIMPLEMENTED();
+
+ plaintext->assign(ciphertext.data(), ciphertext.length());
+ return true;
+}
diff --git a/chrome/browser/password_manager/encryptor_mac.mm b/chrome/browser/password_manager/encryptor_mac.mm
new file mode 100644
index 0000000..435f08d
--- /dev/null
+++ b/chrome/browser/password_manager/encryptor_mac.mm
@@ -0,0 +1,42 @@
+// Copyright (c) 2006-2008 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.
+
+#include "chrome/browser/password_manager/encryptor.h"
+
+#include "base/logging.h"
+#include "base/string_util.h"
+
+bool Encryptor::EncryptString16(const string16& plaintext,
+ std::string* ciphertext) {
+ return EncryptString(UTF16ToUTF8(plaintext), ciphertext);
+}
+
+bool Encryptor::DecryptString16(const std::string& ciphertext,
+ string16* plaintext) {
+ std::string utf8;
+ if (!DecryptString(ciphertext, &utf8))
+ return false;
+
+ *plaintext = UTF8ToUTF16(utf8);
+ return true;
+}
+
+bool Encryptor::EncryptString(const std::string& plaintext,
+ std::string* ciphertext) {
+ // This doesn't actually encrypt, we need to work on the Encryptor API.
+ NOTIMPLEMENTED();
+
+ // this does a copy
+ ciphertext->assign(plaintext.data(), plaintext.length());
+ return true;
+}
+
+bool Encryptor::DecryptString(const std::string& ciphertext,
+ std::string* plaintext) {
+ // This doesn't actually decrypt, we need to work on the Encryptor API.
+ NOTIMPLEMENTED();
+
+ plaintext->assign(ciphertext.data(), ciphertext.length());
+ return true;
+}
diff --git a/chrome/browser/password_manager/encryptor.cc b/chrome/browser/password_manager/encryptor_win.cc
index 0f7ea1d..76a9d3d 100644
--- a/chrome/browser/password_manager/encryptor.cc
+++ b/chrome/browser/password_manager/encryptor_win.cc
@@ -29,7 +29,7 @@ bool Encryptor::EncryptString(const std::string& plaintext,
std::string* ciphertext) {
DATA_BLOB input;
input.pbData = const_cast<BYTE*>(
- reinterpret_cast<const BYTE*>(plaintext.data()));
+ reinterpret_cast<const BYTE*>(plaintext.data()));
input.cbData = static_cast<DWORD>(plaintext.length());
DATA_BLOB output;
@@ -50,7 +50,7 @@ bool Encryptor::DecryptString(const std::string& ciphertext,
std::string* plaintext) {
DATA_BLOB input;
input.pbData = const_cast<BYTE*>(
- reinterpret_cast<const BYTE*>(ciphertext.data()));
+ reinterpret_cast<const BYTE*>(ciphertext.data()));
input.cbData = static_cast<DWORD>(ciphertext.length());
DATA_BLOB output;