X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fkey.h;h=8b033a029f017e74f979721d85f9cc20709a3742;hb=4664aae3fe2eba4eec84d20f1e7e701ceeeb49bd;hp=3c14cfedd51801fc44bd67105e64bb4643c7715e;hpb=2ffba736e9102d016b96c2e5de2ce7757e612667;p=novacoin.git diff --git a/src/key.h b/src/key.h index 3c14cfe..8b033a0 100644 --- a/src/key.h +++ b/src/key.h @@ -1,13 +1,21 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_KEY_H #define BITCOIN_KEY_H +#include +#include + #include #include #include +#include "serialize.h" +#include "uint256.h" +#include "base58.h" + // secp160k1 // const unsigned int PRIVATE_KEY_SIZE = 192; // const unsigned int PUBLIC_KEY_SIZE = 41; @@ -225,6 +233,17 @@ public: { return CBitcoinAddress(GetPubKey()); } + + bool IsValid() + { + if (!fSet) + return false; + + CSecret secret = GetSecret(); + CKey key2; + key2.SetSecret(secret); + return GetPubKey() == key2.GetPubKey(); + } }; #endif