33 private_key.
Set(random_bytes.begin(), random_bytes.end(), fuzzed_data_provider.ConsumeBool());
34 std::string signature;
35 const bool message_signed =
MessageSign(private_key, random_message, signature);
44 (void)
MessageVerify(fuzzed_data_provider.ConsumeRandomLengthString(1024), fuzzed_data_provider.ConsumeRandomLengthString(1024), random_message);
45 (void)
SigningResultString(fuzzed_data_provider.PickValueInArray({SigningResult::OK, SigningResult::PRIVATE_KEY_NOT_AVAILABLE, SigningResult::SIGNING_FAILED}));
FUZZ_TARGET_INIT(message, initialize_message)
static const std::string REGTEST
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)
Users of this module must hold an ECCVerifyHandle.
MessageVerificationResult
The result of a signed message verification.
void initialize_message()
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given chain name.
std::string ConsumeRandomLengthString(size_t max_length)
std::vector< uint8_t > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
uint256 MessageHash(const std::string &message)
Hashes a message for signing and verification in a manner that prevents inadvertently signing a trans...
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
std::string EncodeDestination(const CTxDestination &dest)
An encapsulated private key.
bool IsValid() const
Check whether this private key is valid.