Update to support OEMCrypto v16 with ODK
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
#define COMMON_MOCK_RSA_KEY_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "testing/gmock.h"
|
||||
#include "common/hash_algorithm.h"
|
||||
#include "common/rsa_key.h"
|
||||
|
||||
namespace widevine {
|
||||
@@ -20,12 +22,18 @@ class MockRsaPrivateKey : public RsaPrivateKey {
|
||||
MockRsaPrivateKey() : RsaPrivateKey(RSA_new()) {}
|
||||
~MockRsaPrivateKey() override {}
|
||||
|
||||
MOCK_CONST_METHOD2(Decrypt, bool(const std::string& encrypted_message,
|
||||
std::string* decrypted_message));
|
||||
MOCK_CONST_METHOD2(GenerateSignature,
|
||||
bool(const std::string& message, std::string* signature));
|
||||
MOCK_CONST_METHOD1(MatchesPrivateKey, bool(const RsaPrivateKey& private_key));
|
||||
MOCK_CONST_METHOD1(MatchesPublicKey, bool(const RsaPublicKey& public_key));
|
||||
MOCK_METHOD(bool, Decrypt,
|
||||
(const std::string& encrypted_message,
|
||||
std::string* decrypted_message),
|
||||
(const, override));
|
||||
MOCK_METHOD(bool, GenerateSignature,
|
||||
(const std::string& message, HashAlgorithm hash_algorithm,
|
||||
std::string* signature),
|
||||
(const, override));
|
||||
MOCK_METHOD(bool, MatchesPrivateKey, (const RsaPrivateKey& private_key),
|
||||
(const, override));
|
||||
MOCK_METHOD(bool, MatchesPublicKey, (const RsaPublicKey& public_key),
|
||||
(const, override));
|
||||
|
||||
private:
|
||||
MockRsaPrivateKey(const MockRsaPrivateKey&) = delete;
|
||||
@@ -37,12 +45,18 @@ class MockRsaPublicKey : public RsaPublicKey {
|
||||
MockRsaPublicKey() : RsaPublicKey(RSA_new()) {}
|
||||
~MockRsaPublicKey() override {}
|
||||
|
||||
MOCK_CONST_METHOD2(Encrypt, bool(const std::string& clear_message,
|
||||
std::string* encrypted_message));
|
||||
MOCK_CONST_METHOD2(VerifySignature,
|
||||
bool(const std::string& message, const std::string& signature));
|
||||
MOCK_CONST_METHOD1(MatchesPrivateKey, bool(const RsaPrivateKey& private_key));
|
||||
MOCK_CONST_METHOD1(MatchesPublicKey, bool(const RsaPublicKey& public_key));
|
||||
MOCK_METHOD(bool, Encrypt,
|
||||
(const std::string& clear_message,
|
||||
std::string* encrypted_message),
|
||||
(const, override));
|
||||
MOCK_METHOD(bool, VerifySignature,
|
||||
(const std::string& message, HashAlgorithm hash_algorithm,
|
||||
const std::string& signature),
|
||||
(const, override));
|
||||
MOCK_METHOD(bool, MatchesPrivateKey, (const RsaPrivateKey& private_key),
|
||||
(const, override));
|
||||
MOCK_METHOD(bool, MatchesPublicKey, (const RsaPublicKey& public_key),
|
||||
(const, override));
|
||||
|
||||
private:
|
||||
MockRsaPublicKey(const MockRsaPublicKey&) = delete;
|
||||
@@ -54,14 +68,14 @@ class MockRsaKeyFactory : public RsaKeyFactory {
|
||||
MockRsaKeyFactory() {}
|
||||
~MockRsaKeyFactory() override {}
|
||||
|
||||
MOCK_CONST_METHOD1(CreateFromPkcs1PrivateKey,
|
||||
std::unique_ptr<RsaPrivateKey>(const std::string& private_key));
|
||||
MOCK_CONST_METHOD2(
|
||||
CreateFromPkcs8PrivateKey,
|
||||
std::unique_ptr<RsaPrivateKey>(const std::string& private_key,
|
||||
const std::string& private_key_passphrase));
|
||||
MOCK_CONST_METHOD1(CreateFromPkcs1PublicKey,
|
||||
std::unique_ptr<RsaPublicKey>(const std::string& public_key));
|
||||
MOCK_METHOD(std::unique_ptr<RsaPrivateKey>, CreateFromPkcs1PrivateKey,
|
||||
(const std::string& private_key), (const, override));
|
||||
MOCK_METHOD(std::unique_ptr<RsaPrivateKey>, CreateFromPkcs8PrivateKey,
|
||||
(const std::string& private_key,
|
||||
const std::string& private_key_passphrase),
|
||||
(const, override));
|
||||
MOCK_METHOD(std::unique_ptr<RsaPublicKey>, CreateFromPkcs1PublicKey,
|
||||
(const std::string& public_key), (const, override));
|
||||
|
||||
private:
|
||||
MockRsaKeyFactory(const MockRsaKeyFactory&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user