5 #include <chainparams.h> 32 std::string signature;
33 const bool message_signed =
MessageSign(private_key, random_message, signature);
42 (void)
MessageVerify(fuzzed_data_provider.ConsumeRandomLengthString(1024), fuzzed_data_provider.ConsumeRandomLengthString(1024), random_message);
43 (void)
SigningResultString(fuzzed_data_provider.PickValueInArray({SigningResult::OK, SigningResult::PRIVATE_KEY_NOT_AVAILABLE, SigningResult::SIGNING_FAILED}));
CPubKey GetPubKey() const
Compute the public key from a private key.
MessageVerificationResult MessageVerify(const std::string &address, const std::string &signature, const std::string &message)
Verify a signed message.
bool MessageSign(const CKey &privkey, const std::string &message, std::string &signature)
Sign a message.
std::string SigningResultString(const SigningResult res)
The message verification was successful.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
MessageVerificationResult
The result of a signed message verification.
void initialize_message()
std::string ConsumeRandomLengthString(size_t max_length)
uint256 MessageHash(const std::string &message)
Hashes a message for signing and verification in a manner that prevents inadvertently signing a trans...
std::string EncodeDestination(const CTxDestination &dest)
An encapsulated private key.
FUZZ_TARGET(message,.init=initialize_message)
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
CKey ConsumePrivateKey(FuzzedDataProvider &fuzzed_data_provider, std::optional< bool > compressed) noexcept
bool IsValid() const
Check whether this private key is valid.