Changeset View
Changeset View
Standalone View
Standalone View
src/util/message.h
Show All 38 Lines | enum class MessageVerificationResult { | ||||
//! The message was not signed with the private key of the provided address. | //! The message was not signed with the private key of the provided address. | ||||
ERR_NOT_SIGNED, | ERR_NOT_SIGNED, | ||||
//! The message verification was successful. | //! The message verification was successful. | ||||
OK | OK | ||||
}; | }; | ||||
enum class SigningResult { | |||||
OK, //!< No error | |||||
PRIVATE_KEY_NOT_AVAILABLE, | |||||
SIGNING_FAILED, | |||||
}; | |||||
/** | /** | ||||
* Verify a signed message. | * Verify a signed message. | ||||
* @param[in] chain params to be used to interpret the address. | * @param[in] chain params to be used to interpret the address. | ||||
* @param[in] address Signer's bitcoin address, it must refer to a public key. | * @param[in] address Signer's bitcoin address, it must refer to a public key. | ||||
* @param[in] signature The signature in base64 format. | * @param[in] signature The signature in base64 format. | ||||
* @param[in] message The message that was signed. | * @param[in] message The message that was signed. | ||||
* @return result code | * @return result code | ||||
*/ | */ | ||||
Show All 14 Lines | bool MessageSign(const CKey &privkey, const std::string &message, | ||||
std::string &signature); | std::string &signature); | ||||
/** | /** | ||||
* Hashes a message for signing and verification in a manner that prevents | * Hashes a message for signing and verification in a manner that prevents | ||||
* inadvertently signing a transaction. | * inadvertently signing a transaction. | ||||
*/ | */ | ||||
uint256 MessageHash(const std::string &message); | uint256 MessageHash(const std::string &message); | ||||
std::string SigningResultString(const SigningResult res); | |||||
#endif // BITCOIN_UTIL_MESSAGE_H | #endif // BITCOIN_UTIL_MESSAGE_H |