X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fkey.h;h=6e7196e7134e455c0c5df6422d7cd6f8522cffee;hb=53792d0d27e0c68322f1a4ab402150a8d4fcee6f;hp=45ce39bd4dc78015688ba3d343d260a607a5dff5;hpb=9a848e2cae1fc51c8b76a5d76a69d8fe2d87e078;p=novacoin.git diff --git a/src/key.h b/src/key.h index 45ce39b..6e7196e 100644 --- a/src/key.h +++ b/src/key.h @@ -11,11 +11,11 @@ #include "allocators.h" #include "serialize.h" #include "uint256.h" -#include "hash.h" #include "bignum.h" -#include "ies.h" #include // for EC_KEY definition +#include + // secp160k1 // const unsigned int PRIVATE_KEY_SIZE = 192; @@ -50,16 +50,16 @@ public: class CKeyID : public uint160 { public: - CKeyID() : uint160(0) { } - CKeyID(const uint160 &in) : uint160(in) { } + CKeyID(); + CKeyID(const uint160 &in); }; /** A reference to a CScript: the Hash160 of its serialization (see script.h) */ class CScriptID : public uint160 { public: - CScriptID() : uint160(0) { } - CScriptID(const uint160 &in) : uint160(in) { } + CScriptID(); + CScriptID(const uint160 &in); }; /** An encapsulated OpenSSL Elliptic Curve key (public) */ @@ -160,15 +160,8 @@ public: } } - CKeyID GetID() const - { - return CKeyID(Hash160(vbytes, vbytes + size())); - } - - uint256 GetHash() const - { - return Hash(vbytes, vbytes + size()); - } + CKeyID GetID() const; + uint256 GetHash() const; /* * Check syntactic correctness. @@ -206,9 +199,6 @@ public: // Reserialize to DER static bool ReserealizeSignature(std::vector& vchSig); - - // Encrypt data - void EncryptData(const std::vector& data, std::vector& encrypted); }; // secure_allocator is defined in allocators.h @@ -223,7 +213,6 @@ class CKey protected: EC_KEY* pkey; bool fSet; - bool fCompressedPubKey; public: @@ -243,12 +232,11 @@ public: void SetCompressedPubKey(bool fCompressed=true); void MakeNewKey(bool fCompressed=true); bool SetPrivKey(const CPrivKey& vchPrivKey); - bool SetSecret(const CSecret& vchSecret, bool fCompressed = false); + bool SetSecret(const CSecret& vchSecret, bool fCompressed = true); CSecret GetSecret(bool &fCompressed) const; CSecret GetSecret() const; CPrivKey GetPrivKey() const; CPubKey GetPubKey() const; - bool WritePEM(BIO *streamObj, const SecureString &strPassKey) const; bool Sign(uint256 hash, std::vector& vchSig); @@ -262,9 +250,6 @@ public: // Check whether an element of a signature (r or s) is valid. static bool CheckSignatureElement(const unsigned char *vch, int len, bool half); - - // Decrypt data - void DecryptData(const std::vector& encrypted, std::vector& data); }; class CPoint @@ -431,7 +416,7 @@ public: CMalleableKey GetMalleableKey(const CSecret &vchSecretH) const { return CMalleableKey(vchSecretL, vchSecretH); } bool CheckKeyVariant(const CPubKey &R, const CPubKey &vchPubKeyVariant) const; - bool operator <(const CMalleableKeyView& kv) const { return vchPubKeyH.GetID() < kv.vchPubKeyH.GetID(); } + bool operator <(const CMalleableKeyView& kv) const; }; #endif