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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/crypto/symmetric_key.h" | 10 #include "build/build_config.h" |
11 #include "base/scoped_ptr.h" | 11 |
| 12 #if defined(USE_NSS) |
| 13 #include "base/crypto/scoped_nss_types.h" |
| 14 #elif defined(OS_WIN) |
| 15 #include "base/crypto/scoped_capi_types.h" |
| 16 #endif |
12 | 17 |
13 namespace base { | 18 namespace base { |
14 | 19 |
| 20 class SymmetricKey; |
| 21 |
15 class Encryptor { | 22 class Encryptor { |
16 public: | 23 public: |
17 enum Mode { | 24 enum Mode { |
18 CBC | 25 CBC |
19 }; | 26 }; |
20 Encryptor(); | 27 Encryptor(); |
21 virtual ~Encryptor(); | 28 virtual ~Encryptor(); |
22 | 29 |
23 // Initializes the encryptor using |key| and |iv|. Returns false if either the | 30 // Initializes the encryptor using |key| and |iv|. Returns false if either the |
24 // key or the initialization vector cannot be used. | 31 // key or the initialization vector cannot be used. |
(...skipping 13 matching lines...) Expand all Loading... |
38 | 45 |
39 #if defined(USE_NSS) | 46 #if defined(USE_NSS) |
40 ScopedPK11Slot slot_; | 47 ScopedPK11Slot slot_; |
41 ScopedSECItem param_; | 48 ScopedSECItem param_; |
42 #elif defined(OS_MACOSX) | 49 #elif defined(OS_MACOSX) |
43 bool Crypt(int /*CCOperation*/ op, | 50 bool Crypt(int /*CCOperation*/ op, |
44 const std::string& input, | 51 const std::string& input, |
45 std::string* output); | 52 std::string* output); |
46 | 53 |
47 std::string iv_; | 54 std::string iv_; |
| 55 #elif defined(OS_WIN) |
| 56 ScopedHCRYPTKEY capi_key_; |
| 57 DWORD block_size_; |
48 #endif | 58 #endif |
49 }; | 59 }; |
50 | 60 |
51 } // namespace base | 61 } // namespace base |
52 | 62 |
53 #endif // BASE_CRYPTO_ENCRYPTOR_H_ | 63 #endif // BASE_CRYPTO_ENCRYPTOR_H_ |
OLD | NEW |