| 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 BASE_CRYPTO_SYMMETRIC_KEY_H_ | 5 #ifndef CRYPTO_SYMMETRIC_KEY_H_ |
| 6 #define BASE_CRYPTO_SYMMETRIC_KEY_H_ | 6 #define CRYPTO_SYMMETRIC_KEY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/base_api.h" | |
| 12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 13 | 12 |
| 14 #if defined(USE_NSS) | 13 #if defined(USE_NSS) |
| 15 #include "base/crypto/scoped_nss_types.h" | 14 #include "crypto/scoped_nss_types.h" |
| 16 #elif defined(OS_MACOSX) | 15 #elif defined(OS_MACOSX) |
| 17 #include <Security/cssmtype.h> | 16 #include <Security/cssmtype.h> |
| 18 #elif defined(OS_WIN) | 17 #elif defined(OS_WIN) |
| 19 #include "base/crypto/scoped_capi_types.h" | 18 #include "crypto/scoped_capi_types.h" |
| 20 #endif | 19 #endif |
| 21 | 20 |
| 22 namespace base { | 21 namespace crypto { |
| 23 | 22 |
| 24 // Wraps a platform-specific symmetric key and allows it to be held in a | 23 // Wraps a platform-specific symmetric key and allows it to be held in a |
| 25 // scoped_ptr. | 24 // scoped_ptr. |
| 26 class BASE_API SymmetricKey { | 25 class SymmetricKey { |
| 27 public: | 26 public: |
| 28 // Defines the algorithm that a key will be used with. See also | 27 // Defines the algorithm that a key will be used with. See also |
| 29 // classs Encrptor. | 28 // classs Encrptor. |
| 30 enum Algorithm { | 29 enum Algorithm { |
| 31 AES, | 30 AES, |
| 32 HMAC_SHA1, | 31 HMAC_SHA1, |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 virtual ~SymmetricKey(); | 34 virtual ~SymmetricKey(); |
| 36 | 35 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // |key_|. This is the case of HMAC keys when the key size exceeds 16 bytes | 92 // |key_|. This is the case of HMAC keys when the key size exceeds 16 bytes |
| 94 // when using the default RSA provider. | 93 // when using the default RSA provider. |
| 95 // TODO(rsleevi): See if KP_EFFECTIVE_KEYLEN is the reason why CryptExportKey | 94 // TODO(rsleevi): See if KP_EFFECTIVE_KEYLEN is the reason why CryptExportKey |
| 96 // fails with NTE_BAD_KEY/NTE_BAD_LEN | 95 // fails with NTE_BAD_KEY/NTE_BAD_LEN |
| 97 std::string raw_key_; | 96 std::string raw_key_; |
| 98 #endif | 97 #endif |
| 99 | 98 |
| 100 DISALLOW_COPY_AND_ASSIGN(SymmetricKey); | 99 DISALLOW_COPY_AND_ASSIGN(SymmetricKey); |
| 101 }; | 100 }; |
| 102 | 101 |
| 103 } // namespace base | 102 } // namespace crypto |
| 104 | 103 |
| 105 #endif // BASE_CRYPTO_SYMMETRIC_KEY_H_ | 104 #endif // CRYPTO_SYMMETRIC_KEY_H_ |
| OLD | NEW |