PRCYCoin  2.0.0.7rc1
P2P Digital Currency
messagesigner.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2018 The Dash Core developers
2 // Copyright (c) 2018-2019 The PIVX developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef MESSAGESIGNER_H
7 #define MESSAGESIGNER_H
8 
9 #include "key.h"
10 
14 {
15 public:
17  static bool GetKeysFromSecret(const std::string& strSecret, CKey& keyRet, CPubKey& pubkeyRet);
19  static bool SignMessage(const std::string& strMessage, std::vector<unsigned char>& vchSigRet, const CKey& key);
21  static bool VerifyMessage(const CPubKey& pubkey, const std::vector<unsigned char>& vchSig, const std::string& strMessage, std::string& strErrorRet);
23  static bool VerifyMessage(const CKeyID& keyID, const std::vector<unsigned char>& vchSig, const std::string& strMessage, std::string& strErrorRet);
24 };
25 
29 {
30 public:
32  static bool SignHash(const uint256& hash, const CKey& key, std::vector<unsigned char>& vchSigRet);
34  static bool VerifyHash(const uint256& hash, const CPubKey& pubkey, const std::vector<unsigned char>& vchSig, std::string& strErrorRet);
36  static bool VerifyHash(const uint256& hash, const CKeyID& keyID, const std::vector<unsigned char>& vchSig, std::string& strErrorRet);
37 };
38 
39 #endif
CKeyID
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:29
CMessageSigner::VerifyMessage
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 succcessful.
Definition: messagesigner.cpp:34
CHashSigner
Helper class for signing hashes and checking their signatures.
Definition: messagesigner.h:28
CMessageSigner::SignMessage
static bool SignMessage(const std::string &strMessage, std::vector< unsigned char > &vchSigRet, const CKey &key)
Sign the message, returns true if successful.
Definition: messagesigner.cpp:25
CHashSigner::VerifyHash
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 succcessful.
Definition: messagesigner.cpp:53
CMessageSigner
Helper class for signing messages and checking their signatures.
Definition: messagesigner.h:13
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
CMessageSigner::GetKeysFromSecret
static bool GetKeysFromSecret(const std::string &strSecret, CKey &keyRet, CPubKey &pubkeyRet)
Set the private/public key values, returns true if successful.
Definition: messagesigner.cpp:13
key.h
CPubKey
An encapsulated public key.
Definition: pubkey.h:37
CKey
An encapsulated private key.
Definition: key.h:39
key
CKey key
Definition: bip38tooldialog.cpp:173
CHashSigner::SignHash
static bool SignHash(const uint256 &hash, const CKey &key, std::vector< unsigned char > &vchSigRet)
Sign the hash, returns true if successful.
Definition: messagesigner.cpp:48