| 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
|
|
|