Bitcoin Core  0.19.99
P2P Digital Currency
message.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2020 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_UTIL_MESSAGE_H
7 #define BITCOIN_UTIL_MESSAGE_H
8 
9 #include <key.h> // For CKey
10 #include <uint256.h>
11 
12 #include <string>
13 
14 extern const std::string MESSAGE_MAGIC;
15 
25 
28 
31 
34 
37 
39  OK
40 };
41 
42 enum class SigningResult {
43  OK,
46 };
47 
54  const std::string& address,
55  const std::string& signature,
56  const std::string& message);
57 
63 bool MessageSign(
64  const CKey& privkey,
65  const std::string& message,
66  std::string& signature);
67 
72 uint256 MessageHash(const std::string& message);
73 
74 std::string SigningResultString(const SigningResult res);
75 
76 #endif // BITCOIN_UTIL_MESSAGE_H
The provided signature couldn&#39;t be parsed (maybe invalid base64).
SigningResult
Definition: message.h:42
The message verification was successful.
std::string SigningResultString(const SigningResult res)
Definition: message.cpp:80
MessageVerificationResult
The result of a signed message verification.
Definition: message.h:22
bool MessageSign(const CKey &privkey, const std::string &message, std::string &signature)
Sign a message.
Definition: message.cpp:56
The message was not signed with the private key of the provided address.
256-bit opaque blob.
Definition: uint256.h:120
const std::string MESSAGE_MAGIC
Text used to signify that a signed message follows and to prevent inadvertently signing a transaction...
Definition: message.cpp:22
MessageVerificationResult MessageVerify(const std::string &address, const std::string &signature, const std::string &message)
Verify a signed message.
Definition: message.cpp:24
The provided address is invalid.
An encapsulated private key.
Definition: key.h:27
A public key could not be recovered from the provided signature and message.
uint256 MessageHash(const std::string &message)
Hashes a message for signing and verification in a manner that prevents inadvertently signing a trans...
Definition: message.cpp:72
The provided address is valid but does not refer to a public key.