Bitcoin Core 28.99.0
P2P Digital Currency
|
Go to the source code of this file.
Enumerations | |
enum class | MessageVerificationResult { ERR_INVALID_ADDRESS , ERR_ADDRESS_NO_KEY , ERR_MALFORMED_SIGNATURE , ERR_PUBKEY_NOT_RECOVERED , ERR_NOT_SIGNED , OK } |
The result of a signed message verification. More... | |
enum class | SigningResult { OK , PRIVATE_KEY_NOT_AVAILABLE , SIGNING_FAILED } |
Functions | |
MessageVerificationResult | MessageVerify (const std::string &address, const std::string &signature, const std::string &message) |
Verify a signed message. More... | |
bool | MessageSign (const CKey &privkey, const std::string &message, std::string &signature) |
Sign a message. More... | |
uint256 | MessageHash (const std::string &message) |
Hashes a message for signing and verification in a manner that prevents inadvertently signing a transaction. More... | |
std::string | SigningResultString (const SigningResult res) |
Variables | |
const std::string | MESSAGE_MAGIC |
Text used to signify that a signed message follows and to prevent inadvertently signing a transaction. More... | |
|
strong |
The result of a signed message verification.
Message verification takes as an input:
Definition at line 23 of file signmessage.h.
|
strong |
Enumerator | |
---|---|
OK | No error. |
PRIVATE_KEY_NOT_AVAILABLE | |
SIGNING_FAILED |
Definition at line 43 of file signmessage.h.
uint256 MessageHash | ( | const std::string & | message | ) |
Hashes a message for signing and verification in a manner that prevents inadvertently signing a transaction.
Definition at line 73 of file signmessage.cpp.
bool MessageSign | ( | const CKey & | privkey, |
const std::string & | message, | ||
std::string & | signature | ||
) |
Sign a message.
[in] | privkey | Private key to sign with. |
[in] | message | The message to sign. |
[out] | signature | Signature, base64 encoded, only set if true is returned. |
Definition at line 57 of file signmessage.cpp.
MessageVerificationResult MessageVerify | ( | const std::string & | address, |
const std::string & | signature, | ||
const std::string & | message | ||
) |
Verify a signed message.
[in] | address | Signer's bitcoin address, it must refer to a public key. |
[in] | signature | The signature in base64 format. |
[in] | message | The message that was signed. |
Definition at line 26 of file signmessage.cpp.
std::string SigningResultString | ( | const SigningResult | res | ) |
Definition at line 81 of file signmessage.cpp.
|
extern |
Text used to signify that a signed message follows and to prevent inadvertently signing a transaction.
Definition at line 24 of file signmessage.cpp.