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

Unified Diff: crypto/ec_signature_creator.h

Issue 9455006: Fix SpdySession::WriteCredentialFrame ECPrivateKey creation args. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: openssl fix Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/ec_signature_creator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/ec_signature_creator.h
diff --git a/crypto/ec_signature_creator.h b/crypto/ec_signature_creator.h
index 8858eb50868d99527461af68be4897024d90020f..610b9f05240d51f7a1a9fa2a29974ab3697500e6 100644
--- a/crypto/ec_signature_creator.h
+++ b/crypto/ec_signature_creator.h
@@ -14,13 +14,21 @@
namespace crypto {
class ECPrivateKey;
+class ECSignatureCreator;
+
+class CRYPTO_EXPORT ECSignatureCreatorFactory {
+ public:
+ virtual ~ECSignatureCreatorFactory() {}
+
+ virtual ECSignatureCreator* Create(ECPrivateKey* key) = 0;
+};
// Signs data using a bare private key (as opposed to a full certificate).
// We need this class because SignatureCreator is hardcoded to use
// RSAPrivateKey.
class CRYPTO_EXPORT ECSignatureCreator {
public:
- ~ECSignatureCreator();
+ virtual ~ECSignatureCreator() {}
// Create an instance. The caller must ensure that the provided PrivateKey
// instance outlives the created ECSignatureCreator.
@@ -28,23 +36,21 @@ class CRYPTO_EXPORT ECSignatureCreator {
// pass in the hash algorithm identifier.
static ECSignatureCreator* Create(ECPrivateKey* key);
+ // Set a factory to make the Create function return non-standard
+ // ECSignatureCreator objects. Because the ECDSA algorithm involves
+ // randomness, this is useful for higher-level tests that want to have
+ // deterministic mocked output to compare.
+ static void SetFactoryForTesting(ECSignatureCreatorFactory* factory);
+
// Signs |data_len| bytes from |data| and writes the results into
// |signature| as a DER encoded ECDSA-Sig-Value from RFC 3279.
//
// ECDSA-Sig-Value ::= SEQUENCE {
// r INTEGER,
// s INTEGER }
- bool Sign(const uint8* data,
- int data_len,
- std::vector<uint8>* signature);
-
- private:
- // Private constructor. Use the Create() method instead.
- explicit ECSignatureCreator(ECPrivateKey* key);
-
- ECPrivateKey* key_;
-
- DISALLOW_COPY_AND_ASSIGN(ECSignatureCreator);
+ virtual bool Sign(const uint8* data,
+ int data_len,
+ std::vector<uint8>* signature) = 0;
};
} // namespace crypto
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/ec_signature_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698