OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/password_manager/encryptor.h" | 5 #include "chrome/browser/password_manager/encryptor.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 | 9 |
10 bool Encryptor::EncryptString16(const string16& plaintext, | 10 bool Encryptor::EncryptString16(const string16& plaintext, |
11 std::string* ciphertext) { | 11 std::string* ciphertext) { |
12 return EncryptString(UTF16ToUTF8(plaintext), ciphertext); | 12 return EncryptString(UTF16ToUTF8(plaintext), ciphertext); |
13 } | 13 } |
14 | 14 |
15 bool Encryptor::DecryptString16(const std::string& ciphertext, | 15 bool Encryptor::DecryptString16(const std::string& ciphertext, |
16 string16* plaintext) { | 16 string16* plaintext) { |
17 std::string utf8; | 17 std::string utf8; |
18 if (!DecryptString(ciphertext, &utf8)) | 18 if (!DecryptString(ciphertext, &utf8)) |
19 return false; | 19 return false; |
20 | 20 |
21 *plaintext = UTF8ToUTF16(utf8); | 21 *plaintext = UTF8ToUTF16(utf8); |
22 return true; | 22 return true; |
23 } | 23 } |
24 | 24 |
25 bool Encryptor::EncryptString(const std::string& plaintext, | 25 bool Encryptor::EncryptString(const std::string& plaintext, |
26 std::string* ciphertext) { | 26 std::string* ciphertext) { |
27 // This doesn't actually encrypt, we need to work on the Encryptor API. | 27 // This doesn't actually encrypt, we need to work on the Encryptor API. |
28 // http://code.google.com/p/chromium/issues/detail?id=8205 | 28 // http://code.google.com/p/chromium/issues/detail?id=25404 |
29 NOTIMPLEMENTED(); | |
30 | 29 |
31 // this does a copy | 30 // this does a copy |
32 ciphertext->assign(plaintext.data(), plaintext.length()); | 31 ciphertext->assign(plaintext.data(), plaintext.length()); |
33 return true; | 32 return true; |
34 } | 33 } |
35 | 34 |
36 bool Encryptor::DecryptString(const std::string& ciphertext, | 35 bool Encryptor::DecryptString(const std::string& ciphertext, |
37 std::string* plaintext) { | 36 std::string* plaintext) { |
38 // This doesn't actually decrypt, we need to work on the Encryptor API. | 37 // This doesn't actually decrypt, we need to work on the Encryptor API. |
39 // http://code.google.com/p/chromium/issues/detail?id=8205 | 38 // http://code.google.com/p/chromium/issues/detail?id=25404 |
40 NOTIMPLEMENTED(); | |
41 | 39 |
42 plaintext->assign(ciphertext.data(), ciphertext.length()); | 40 plaintext->assign(ciphertext.data(), ciphertext.length()); |
43 return true; | 41 return true; |
44 } | 42 } |
OLD | NEW |