X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fkey.cpp;h=6c0a57dd131e21b2ae8989bdfcf2a173444128b6;hb=9d14e64825d95061ea0857267646dfcb3d62e07a;hp=c37b1023fdf3d6bbf62986e48b92cb808ccae868;hpb=7f70ddc68f4afa4a87a15e620ba519afbc5c8b15;p=novacoin.git diff --git a/src/key.cpp b/src/key.cpp index c37b102..6c0a57d 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -6,12 +6,9 @@ #include #include -#include -#include #include "key.h" #include "base58.h" -#include "ies.h" // Generate a private key from just the secret parameter int EC_KEY_regenerate_key(EC_KEY *eckey, BIGNUM *priv_key) @@ -783,15 +780,6 @@ CMalleableKey::CMalleableKey(const CSecret &L, const CSecret &H) SetSecrets(L, H); } -/* -CMalleableKey& CMalleableKey::operator=(const CMalleableKey &b) -{ - SetSecrets(b.vchSecretL, b.vchSecretH); - - return (*this); -} -*/ - CMalleableKey::~CMalleableKey() { } @@ -806,7 +794,7 @@ bool CMalleableKey::SetSecrets(const CSecret &pvchSecretL, const CSecret &pvchSe Reset(); CKey L, H; - if (pvchSecretL.size() != 32 || !pvchSecretH.size() != 32 || !L.SetSecret(pvchSecretL, true) || !H.SetSecret(pvchSecretH, true)) + if (pvchSecretL.size() != 32 || pvchSecretH.size() != 32 || !L.SetSecret(pvchSecretL, true) || !H.SetSecret(pvchSecretH, true)) { nVersion = 0; return false; @@ -819,12 +807,6 @@ bool CMalleableKey::SetSecrets(const CSecret &pvchSecretL, const CSecret &pvchSe return true; } -void CMalleableKey::GetSecrets(CSecret &pvchSecretL, CSecret &pvchSecretH) const -{ - pvchSecretL = vchSecretL; - pvchSecretH = vchSecretH; -} - CMalleablePubKey CMalleableKey::GetMalleablePubKey() const { CKey L, H; @@ -1015,11 +997,16 @@ bool CMalleableKey::SetString(const std::string& strMutableKey) CDataStream ssKey(vchTemp, SER_NETWORK, PROTOCOL_VERSION); ssKey >> *this; - return IsNull(); + return IsValid(); } // CMalleableKeyView +CMalleableKeyView::CMalleableKeyView(const std::string &strMalleableKey) +{ + SetString(strMalleableKey); +} + CMalleableKeyView::CMalleableKeyView(const CMalleableKey &b) { if (b.vchSecretL.size() != 32) @@ -1044,13 +1031,6 @@ CMalleableKeyView::CMalleableKeyView(const CMalleableKeyView &b) nVersion = CURRENT_VERSION; } -CMalleableKeyView::CMalleableKeyView(const CSecret &L, const CPubKey &pvchPubKeyH) -{ - vchSecretL = L; - vchPubKeyH = pvchPubKeyH.Raw(); - nVersion = CURRENT_VERSION; -} - CMalleableKeyView& CMalleableKeyView::operator=(const CMalleableKey &b) { vchSecretL = b.vchSecretL; @@ -1155,7 +1135,7 @@ bool CMalleableKeyView::SetString(const std::string& strMutableKey) CDataStream ssKey(vchTemp, SER_NETWORK, PROTOCOL_VERSION); ssKey >> *this; - return IsNull(); + return IsValid(); } std::vector CMalleableKeyView::Raw() const