mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Have setFamilySeedGeneric detect prohibited seeds.
This commit is contained in:
@@ -298,7 +298,7 @@ void NewcoinAddress::setAccountPublic(const std::vector<unsigned char>& vPublic)
|
||||
|
||||
void NewcoinAddress::setAccountPublic(const NewcoinAddress& generator, int seq)
|
||||
{
|
||||
CKey pubkey = CKey(generator, seq+1);
|
||||
CKey pubkey = CKey(generator, seq);
|
||||
|
||||
setAccountPublic(pubkey.GetPubKey());
|
||||
}
|
||||
@@ -371,7 +371,7 @@ void NewcoinAddress::setAccountPrivate(uint256 hash256)
|
||||
|
||||
void NewcoinAddress::setAccountPrivate(const NewcoinAddress& generator, const NewcoinAddress& seed, int seq)
|
||||
{
|
||||
CKey privkey = CKey(generator, seed.getFamilyPrivateKey(), seq+1);
|
||||
CKey privkey = CKey(generator, seed.getFamilyPrivateKey(), seq);
|
||||
|
||||
setAccountPrivate(privkey.GetPrivKey());
|
||||
}
|
||||
@@ -646,9 +646,18 @@ bool NewcoinAddress::setFamilySeed(const std::string& strSeed)
|
||||
return SetString(strSeed.c_str(), VER_FAMILY_SEED);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setFamilySeedGeneric(const std::string& strText)
|
||||
bool NewcoinAddress::setFamilySeedGeneric(const std::string& strText)
|
||||
{
|
||||
if (setFamilySeed(strText))
|
||||
NewcoinAddress naTemp;
|
||||
bool bResult = true;
|
||||
|
||||
if (naTemp.setAccountID(strText)
|
||||
|| naTemp.setAccountPublic(strText)
|
||||
|| naTemp.setAccountPrivate(strText))
|
||||
{
|
||||
bResult = false;
|
||||
}
|
||||
else if (setFamilySeed(strText))
|
||||
{
|
||||
// std::cerr << "Recognized seed." << std::endl;
|
||||
nothing();
|
||||
@@ -663,6 +672,8 @@ void NewcoinAddress::setFamilySeedGeneric(const std::string& strText)
|
||||
// std::cerr << "Creating seed from pass phrase." << std::endl;
|
||||
setFamilySeed(CKey::PassPhraseToKey(strText));
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void NewcoinAddress::setFamilySeed(uint128 hash128) {
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
//
|
||||
// Family Seeds
|
||||
//
|
||||
// Clients must disallow reconizable entries from being seeds.
|
||||
uint128 getFamilySeed() const;
|
||||
BIGNUM* getFamilyPrivateKey() const;
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
|
||||
bool setFamilySeed(const std::string& strSeed);
|
||||
int setFamilySeed1751(const std::string& strHuman1751);
|
||||
void setFamilySeedGeneric(const std::string& strText);
|
||||
bool setFamilySeedGeneric(const std::string& strText);
|
||||
void setFamilySeed(uint128 hash128);
|
||||
void setFamilySeedRandom();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user