#include <key.h>
#include <uint256.h>
#include <string>
Go to the source code of this file.
|
| const std::string | MESSAGE_MAGIC |
| | Text used to signify that a signed message follows and to prevent inadvertently signing a transaction. More...
|
| |
The result of a signed message verification.
Message verification takes as an input:
- address (with whose private key the message is supposed to have been signed)
- signature
- message
| Enumerator |
|---|
| ERR_INVALID_ADDRESS |
The provided address is invalid.
|
| ERR_ADDRESS_NO_KEY |
The provided address is valid but does not refer to a public key.
|
| ERR_MALFORMED_SIGNATURE |
The provided signature couldn't be parsed (maybe invalid base64).
|
| ERR_PUBKEY_NOT_RECOVERED |
A public key could not be recovered from the provided signature and message.
|
| ERR_NOT_SIGNED |
The message was not signed with the private key of the provided address.
|
| OK |
The message verification was successful.
|
Definition at line 22 of file message.h.
| Enumerator |
|---|
| OK |
No error.
|
| PRIVATE_KEY_NOT_AVAILABLE |
|
| SIGNING_FAILED |
|
Definition at line 42 of file message.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 72 of file message.cpp.
| bool MessageSign |
( |
const CKey & |
privkey, |
|
|
const std::string & |
message, |
|
|
std::string & |
signature |
|
) |
| |
Sign a message.
- Parameters
-
| [in] | privkey | Private key to sign with. |
| [in] | message | The message to sign. |
| [out] | signature | Signature, base64 encoded, only set if true is returned. |
- Returns
- true if signing was successful.
Definition at line 56 of file message.cpp.
| MessageVerificationResult MessageVerify |
( |
const std::string & |
address, |
|
|
const std::string & |
signature, |
|
|
const std::string & |
message |
|
) |
| |
Verify a signed message.
- Parameters
-
| [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. |
- Returns
- result code
Definition at line 24 of file message.cpp.
| const std::string MESSAGE_MAGIC |
Text used to signify that a signed message follows and to prevent inadvertently signing a transaction.
Definition at line 22 of file message.cpp.