return EncodeBase58Check(vch);
}
+std::vector<unsigned char> CMalleablePubKey::Raw() const
+{
+ CDataStream ssKey(SER_NETWORK, PROTOCOL_VERSION);
+ ssKey << *this;
+ std::vector<unsigned char> vch(ssKey.begin(), ssKey.end());
+
+ return vch;
+}
+
bool CMalleablePubKey::SetString(const std::string& strMalleablePubKey)
{
std::vector<unsigned char> vchTemp;
SetSecrets(L, H);
}
-CMalleableKey& CMalleableKey::operator=(const CMalleableKey &b)
-{
- SetSecrets(b.vchSecretL, b.vchSecretH);
-
- return (*this);
-}
-
CMalleableKey::~CMalleableKey()
{
}
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;
return true;
}
-void CMalleableKey::GetSecrets(CSecret &pvchSecretL, CSecret &pvchSecretH) const
-{
- pvchSecretL = vchSecretL;
- pvchSecretH = vchSecretH;
-}
-
CMalleablePubKey CMalleableKey::GetMalleablePubKey() const
{
CKey L, H;
return EncodeBase58Check(vch);
}
+std::vector<unsigned char> CMalleableKey::Raw() const
+{
+ CDataStream ssKey(SER_NETWORK, PROTOCOL_VERSION);
+ ssKey << *this;
+ std::vector<unsigned char> vch(ssKey.begin(), ssKey.end());
+
+ return vch;
+}
+
bool CMalleableKey::SetString(const std::string& strMutableKey)
{
std::vector<unsigned char> vchTemp;
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)
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;
CDataStream ssKey(vchTemp, SER_NETWORK, PROTOCOL_VERSION);
ssKey >> *this;
- return IsNull();
+ return IsValid();
+}
+
+std::vector<unsigned char> CMalleableKeyView::Raw() const
+{
+ CDataStream ssKey(SER_NETWORK, PROTOCOL_VERSION);
+ ssKey << *this;
+ std::vector<unsigned char> vch(ssKey.begin(), ssKey.end());
+
+ return vch;
}
+
bool CMalleableKeyView::IsNull() const
{
return nVersion != CURRENT_VERSION;