32 keyIDRet = pubkey.
GetID();
92 strErrorRet =
"Error recovering public key.";
96 if(pubkeyFromSig.
GetID() != keyID) {
97 strErrorRet =
strprintf(
"Keys don't match: pubkey=%s, pubkeyFromSig=%s, hash=%s, vchSig=%s",
118 std::string strError =
"";
122 return error(
"%s : SignHash() failed", __func__);
126 return error(
"%s : VerifyHash() failed, error: %s", __func__, strError);
138 return error(
"%s : Invalid strSignKey", __func__);
149 return error(
"%s : SignHash() failed", __func__);
157 std::string strError =
"";
CBLSSignature Sign(const uint256 &hash) const
bool VerifyInsecure(const CBLSPublicKey &pubKey, const uint256 &hash) const
std::vector< uint8_t > ToByteVector() const
static bool SignHash(const uint256 &hash, const CKey &key, std::vector< unsigned char > &vchSigRet)
Sign the hash, returns true if successful.
static bool VerifyHash(const uint256 &hash, const CPubKey &pubkey, const std::vector< unsigned char > &vchSig, std::string &strErrorRet)
Verify the hash signature, returns true if successful.
A writer stream (for serialization) that computes a 256-bit hash.
An encapsulated private key.
bool IsValid() const
Check whether this private key is valid.
CPubKey GetPubKey() const
Compute the public key from a private key.
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
Create a compact signature (65 bytes), which allows reconstructing the used public key.
A reference to a CKey: the Hash160 of its serialized public key.
static bool SignMessage(const std::string &strMessage, std::vector< unsigned char > &vchSigRet, const CKey &key)
Sign the message, returns true if successful.
static bool VerifyMessage(const CPubKey &pubkey, const std::vector< unsigned char > &vchSig, const std::string &strMessage, std::string &strErrorRet)
Verify the message signature, returns true if successful.
static bool GetKeysFromSecret(const std::string &strSecret, CKey &keyRet, CPubKey &pubkeyRet)
Set the private/public key values, returns true if successful.
static uint256 GetMessageHash(const std::string &strMessage)
Get the hash based on the input message.
An encapsulated public key.
bool RecoverCompact(const uint256 &hash, const std::vector< unsigned char > &vchSig)
Recover a public key from a compact signature.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
bool Sign(const CKey &key, const CKeyID &keyID)
CSignedMessage Class Functions inherited by network signed-messages.
bool CheckSignature(const CKeyID &keyID) const
virtual std::string GetStrMessage() const =0
virtual uint256 GetSignatureHash() const =0
std::string GetSignatureBase64() const
std::vector< unsigned char > vchSig
std::string ToString() const
CKey DecodeSecret(const std::string &str)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
bool error(const char *fmt, const Args &... args)
const std::string strMessageMagic
std::string EncodeBase64(Span< const unsigned char > input)