| 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 #ifndef CRYPTO_SIGNATURE_CREATOR_H_ | 5 #ifndef CRYPTO_SIGNATURE_CREATOR_H_ |
| 6 #define CRYPTO_SIGNATURE_CREATOR_H_ | 6 #define CRYPTO_SIGNATURE_CREATOR_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(USE_OPENSSL) | |
| 11 // Forward declaration for openssl/*.h | |
| 12 typedef struct env_md_ctx_st EVP_MD_CTX; | |
| 13 #elif defined(USE_NSS) | |
| 14 // Forward declaration. | |
| 15 struct SGNContextStr; | |
| 16 #elif defined(OS_MACOSX) && !defined(OS_IOS) | |
| 17 #include <Security/cssm.h> | |
| 18 #endif | |
| 19 | |
| 20 #include <vector> | 10 #include <vector> |
| 21 | 11 |
| 22 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 23 #include "crypto/crypto_export.h" | 13 #include "crypto/crypto_export.h" |
| 24 | 14 |
| 25 #if defined(OS_WIN) | 15 #if defined(USE_OPENSSL) |
| 26 #include "crypto/scoped_capi_types.h" | 16 // Forward declaration for openssl/*.h |
| 17 typedef struct env_md_ctx_st EVP_MD_CTX; |
| 18 #elif defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX) |
| 19 // Forward declaration. |
| 20 struct SGNContextStr; |
| 27 #endif | 21 #endif |
| 28 | 22 |
| 29 namespace crypto { | 23 namespace crypto { |
| 30 | 24 |
| 31 class RSAPrivateKey; | 25 class RSAPrivateKey; |
| 32 | 26 |
| 33 // Signs data using a bare private key (as opposed to a full certificate). | 27 // Signs data using a bare private key (as opposed to a full certificate). |
| 34 // Currently can only sign data using SHA-1 with RSA encryption. | 28 // Currently can only sign data using SHA-1 with RSA encryption. |
| 35 class CRYPTO_EXPORT SignatureCreator { | 29 class CRYPTO_EXPORT SignatureCreator { |
| 36 public: | 30 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 bool Final(std::vector<uint8>* signature); | 41 bool Final(std::vector<uint8>* signature); |
| 48 | 42 |
| 49 private: | 43 private: |
| 50 // Private constructor. Use the Create() method instead. | 44 // Private constructor. Use the Create() method instead. |
| 51 SignatureCreator(); | 45 SignatureCreator(); |
| 52 | 46 |
| 53 RSAPrivateKey* key_; | 47 RSAPrivateKey* key_; |
| 54 | 48 |
| 55 #if defined(USE_OPENSSL) | 49 #if defined(USE_OPENSSL) |
| 56 EVP_MD_CTX* sign_context_; | 50 EVP_MD_CTX* sign_context_; |
| 57 #elif defined(USE_NSS) | 51 #elif defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX) |
| 58 SGNContextStr* sign_context_; | 52 SGNContextStr* sign_context_; |
| 59 #elif defined(OS_MACOSX) && !defined(OS_IOS) | |
| 60 CSSM_CC_HANDLE sig_handle_; | |
| 61 #elif defined(OS_WIN) | |
| 62 ScopedHCRYPTHASH hash_object_; | |
| 63 #endif | 53 #endif |
| 64 | 54 |
| 65 DISALLOW_COPY_AND_ASSIGN(SignatureCreator); | 55 DISALLOW_COPY_AND_ASSIGN(SignatureCreator); |
| 66 }; | 56 }; |
| 67 | 57 |
| 68 } // namespace crypto | 58 } // namespace crypto |
| 69 | 59 |
| 70 #endif // CRYPTO_SIGNATURE_CREATOR_H_ | 60 #endif // CRYPTO_SIGNATURE_CREATOR_H_ |
| OLD | NEW |