Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: crypto/signature_creator.h

Issue 18697003: Introduce RSAPrivateKey::SignDigest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For landing Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | crypto/signature_creator_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 // 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).
28 // Currently can only sign data using SHA-1 with RSA encryption. 28 // Currently can only sign data using SHA-1 with RSA encryption.
29 class CRYPTO_EXPORT SignatureCreator { 29 class CRYPTO_EXPORT SignatureCreator {
30 public: 30 public:
31 ~SignatureCreator(); 31 ~SignatureCreator();
32 32
33 // Create an instance. The caller must ensure that the provided PrivateKey 33 // Create an instance. The caller must ensure that the provided PrivateKey
34 // instance outlives the created SignatureCreator. 34 // instance outlives the created SignatureCreator.
35 static SignatureCreator* Create(RSAPrivateKey* key); 35 static SignatureCreator* Create(RSAPrivateKey* key);
36 36
37 // Signs the precomputed SHA-1 digest |data| using private |key| as
38 // specified in PKCS #1 v1.5.
39 static bool Sign(RSAPrivateKey* key,
40 const uint8* data,
41 int data_len,
42 std::vector<uint8>* signature);
43
37 // Update the signature with more data. 44 // Update the signature with more data.
38 bool Update(const uint8* data_part, int data_part_len); 45 bool Update(const uint8* data_part, int data_part_len);
39 46
40 // Finalize the signature. 47 // Finalize the signature.
41 bool Final(std::vector<uint8>* signature); 48 bool Final(std::vector<uint8>* signature);
42 49
43 private: 50 private:
44 // Private constructor. Use the Create() method instead. 51 // Private constructor. Use the Create() method instead.
45 SignatureCreator(); 52 SignatureCreator();
46 53
47 RSAPrivateKey* key_; 54 RSAPrivateKey* key_;
48 55
49 #if defined(USE_OPENSSL) 56 #if defined(USE_OPENSSL)
50 EVP_MD_CTX* sign_context_; 57 EVP_MD_CTX* sign_context_;
51 #elif defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX) 58 #elif defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX)
52 SGNContextStr* sign_context_; 59 SGNContextStr* sign_context_;
53 #endif 60 #endif
54 61
55 DISALLOW_COPY_AND_ASSIGN(SignatureCreator); 62 DISALLOW_COPY_AND_ASSIGN(SignatureCreator);
56 }; 63 };
57 64
58 } // namespace crypto 65 } // namespace crypto
59 66
60 #endif // CRYPTO_SIGNATURE_CREATOR_H_ 67 #endif // CRYPTO_SIGNATURE_CREATOR_H_
OLDNEW
« no previous file with comments | « no previous file | crypto/signature_creator_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698