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 "crypto/openpgp_symmetric_encryption.h" | 5 #include "crypto/openpgp_symmetric_encryption.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <sechash.h> | 9 #include <sechash.h> |
10 #include <cryptohi.h> | 10 #include <cryptohi.h> |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 } | 764 } |
765 }; | 765 }; |
766 | 766 |
767 } // anonymous namespace | 767 } // anonymous namespace |
768 | 768 |
769 // static | 769 // static |
770 OpenPGPSymmetricEncrytion::Result OpenPGPSymmetricEncrytion::Decrypt( | 770 OpenPGPSymmetricEncrytion::Result OpenPGPSymmetricEncrytion::Decrypt( |
771 base::StringPiece encrypted, | 771 base::StringPiece encrypted, |
772 base::StringPiece passphrase, | 772 base::StringPiece passphrase, |
773 std::string *out) { | 773 std::string *out) { |
| 774 LOG(ERROR) << "HIIIIIIIIIIIIIIIIIIIIIIIIIII"; |
774 EnsureNSSInit(); | 775 EnsureNSSInit(); |
775 | 776 |
776 Decrypter decrypter; | 777 Decrypter decrypter; |
777 base::StringPiece result; | 778 base::StringPiece result; |
778 Result reader = decrypter.Decrypt(encrypted, passphrase, &result); | 779 Result reader = decrypter.Decrypt(encrypted, passphrase, &result); |
779 if (reader == OK) | 780 if (reader == OK) |
780 *out = result.as_string(); | 781 *out = result.as_string(); |
781 return reader; | 782 return reader; |
782 } | 783 } |
783 | 784 |
784 // static | 785 // static |
785 std::string OpenPGPSymmetricEncrytion::Encrypt( | 786 std::string OpenPGPSymmetricEncrytion::Encrypt( |
786 base::StringPiece plaintext, | 787 base::StringPiece plaintext, |
787 base::StringPiece passphrase) { | 788 base::StringPiece passphrase) { |
| 789 LOG(ERROR) << "HIIIIIIIIIIIIIIIIIIIIIIIIIII"; |
788 EnsureNSSInit(); | 790 EnsureNSSInit(); |
789 | 791 |
790 Encrypter::ByteString b = | 792 Encrypter::ByteString b = |
791 Encrypter::Encrypt(plaintext, passphrase); | 793 Encrypter::Encrypt(plaintext, passphrase); |
792 return std::string(reinterpret_cast<const char*>(b.data()), b.size()); | 794 return std::string(reinterpret_cast<const char*>(b.data()), b.size()); |
793 } | 795 } |
794 | 796 |
795 } // namespace crypto | 797 } // namespace crypto |
OLD | NEW |