mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
db747ea384
3bcc0059b8
Add lint-include-guards.sh which checks include guard consistency (practicalswift)8fd6af89a0
Fix missing or inconsistent include guards (practicalswift)8af65d96f4
Document include guard convention (practicalswift) Pull request description: * **Documentation**: Document include guard convention * **Fix**: Fix missing or inconsistent include guards * **Regression test**: Add `lint-include-guards.sh` which checks include guard consistency Tree-SHA512: 8171878f60fd08ccbea943a11e835195750592abb9d7ab74eaa4265ae7fac523b1da9d31ca13d6ab73dd596e49986bfb7593c696e5f39567c93e610165bc2acc Signed-off-by: pasta <pasta@dashboost.org> # Conflicts: # src/bech32.h # src/consensus/merkle.h # src/key_io.h # src/policy/fees.h # src/rpc/server.h # src/script/bitcoinconsensus.h # src/wallet/coinselection.h
39 lines
1.8 KiB
C++
39 lines
1.8 KiB
C++
// Copyright (c) 2014-2019 The Dash Core developers
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_MESSAGESIGNER_H
|
|
#define BITCOIN_MESSAGESIGNER_H
|
|
|
|
#include <key.h>
|
|
|
|
/** Helper class for signing messages and checking their signatures
|
|
*/
|
|
class CMessageSigner
|
|
{
|
|
public:
|
|
/// Set the private/public key values, returns true if successful
|
|
static bool GetKeysFromSecret(const std::string& strSecret, CKey& keyRet, CPubKey& pubkeyRet);
|
|
/// Sign the message, returns true if successful
|
|
static bool SignMessage(const std::string& strMessage, std::vector<unsigned char>& vchSigRet, const CKey& key);
|
|
/// Verify the message signature, returns true if succcessful
|
|
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
|
|
static bool VerifyMessage(const CKeyID& keyID, const std::vector<unsigned char>& vchSig, const std::string& strMessage, std::string& strErrorRet);
|
|
};
|
|
|
|
/** Helper class for signing hashes and checking their signatures
|
|
*/
|
|
class CHashSigner
|
|
{
|
|
public:
|
|
/// Sign the hash, returns true if successful
|
|
static bool SignHash(const uint256& hash, const CKey& key, std::vector<unsigned char>& vchSigRet);
|
|
/// Verify the hash signature, returns true if succcessful
|
|
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
|
|
static bool VerifyHash(const uint256& hash, const CKeyID& keyID, const std::vector<unsigned char>& vchSig, std::string& strErrorRet);
|
|
};
|
|
|
|
#endif // BITCOIN_MESSAGESIGNER_H
|