OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CRYPTO_ENCRYPTOR_H_ | 5 #ifndef CRYPTO_ENCRYPTOR_H_ |
6 #define CRYPTO_ENCRYPTOR_H_ | 6 #define CRYPTO_ENCRYPTOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "crypto/crypto_api.h" |
12 | 13 |
13 #if defined(USE_NSS) | 14 #if defined(USE_NSS) |
14 #include "crypto/scoped_nss_types.h" | 15 #include "crypto/scoped_nss_types.h" |
15 #elif defined(OS_WIN) | 16 #elif defined(OS_WIN) |
16 #include "crypto/scoped_capi_types.h" | 17 #include "crypto/scoped_capi_types.h" |
17 #endif | 18 #endif |
18 | 19 |
19 namespace crypto { | 20 namespace crypto { |
20 | 21 |
21 class SymmetricKey; | 22 class SymmetricKey; |
22 | 23 |
23 class Encryptor { | 24 class CRYPTO_API Encryptor { |
24 public: | 25 public: |
25 enum Mode { | 26 enum Mode { |
26 CBC | 27 CBC |
27 }; | 28 }; |
28 Encryptor(); | 29 Encryptor(); |
29 virtual ~Encryptor(); | 30 virtual ~Encryptor(); |
30 | 31 |
31 // Initializes the encryptor using |key| and |iv|. Returns false if either the | 32 // Initializes the encryptor using |key| and |iv|. Returns false if either the |
32 // key or the initialization vector cannot be used. | 33 // key or the initialization vector cannot be used. |
33 bool Init(SymmetricKey* key, Mode mode, const std::string& iv); | 34 bool Init(SymmetricKey* key, Mode mode, const std::string& iv); |
(...skipping 26 matching lines...) Expand all Loading... |
60 std::string iv_; | 61 std::string iv_; |
61 #elif defined(OS_WIN) | 62 #elif defined(OS_WIN) |
62 ScopedHCRYPTKEY capi_key_; | 63 ScopedHCRYPTKEY capi_key_; |
63 DWORD block_size_; | 64 DWORD block_size_; |
64 #endif | 65 #endif |
65 }; | 66 }; |
66 | 67 |
67 } // namespace crypto | 68 } // namespace crypto |
68 | 69 |
69 #endif // CRYPTO_ENCRYPTOR_H_ | 70 #endif // CRYPTO_ENCRYPTOR_H_ |
OLD | NEW |