| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef BASE_CRYPTO_ENCRYPTOR_H_ | 5 #ifndef BASE_CRYPTO_ENCRYPTOR_H_ |
| 6 #define BASE_CRYPTO_ENCRYPTOR_H_ | 6 #define BASE_CRYPTO_ENCRYPTOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 // Decrypts |ciphertext| into |plaintext|. | 38 // Decrypts |ciphertext| into |plaintext|. |
| 39 bool Decrypt(const std::string& ciphertext, std::string* plaintext); | 39 bool Decrypt(const std::string& ciphertext, std::string* plaintext); |
| 40 | 40 |
| 41 // TODO(albertb): Support streaming encryption. | 41 // TODO(albertb): Support streaming encryption. |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 SymmetricKey* key_; | 44 SymmetricKey* key_; |
| 45 Mode mode_; | 45 Mode mode_; |
| 46 | 46 |
| 47 #if defined(USE_NSS) | 47 #if defined(USE_OPENSSL) |
| 48 bool Crypt(bool encrypt, // Pass true to encrypt, false to decrypt. |
| 49 const std::string& input, |
| 50 std::string* output); |
| 51 std::string iv_; |
| 52 #elif defined(USE_NSS) |
| 48 ScopedPK11Slot slot_; | 53 ScopedPK11Slot slot_; |
| 49 ScopedSECItem param_; | 54 ScopedSECItem param_; |
| 50 #elif defined(OS_MACOSX) | 55 #elif defined(OS_MACOSX) |
| 51 bool Crypt(int /*CCOperation*/ op, | 56 bool Crypt(int /*CCOperation*/ op, |
| 52 const std::string& input, | 57 const std::string& input, |
| 53 std::string* output); | 58 std::string* output); |
| 54 | 59 |
| 55 std::string iv_; | 60 std::string iv_; |
| 56 #elif defined(OS_WIN) | 61 #elif defined(OS_WIN) |
| 57 ScopedHCRYPTKEY capi_key_; | 62 ScopedHCRYPTKEY capi_key_; |
| 58 DWORD block_size_; | 63 DWORD block_size_; |
| 59 #endif | 64 #endif |
| 60 }; | 65 }; |
| 61 | 66 |
| 62 } // namespace base | 67 } // namespace base |
| 63 | 68 |
| 64 #endif // BASE_CRYPTO_ENCRYPTOR_H_ | 69 #endif // BASE_CRYPTO_ENCRYPTOR_H_ |
| OLD | NEW |