mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-11-21 10:43:54 +01:00
Verify status of encrypt/decrypt calls to detect failed padding
This commit is contained in:
committed by
Luke Dashjr
parent
bf754cfd01
commit
c7057326ea
@@ -71,6 +71,8 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
|
||||
CSecret vchSecret;
|
||||
if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret))
|
||||
return false;
|
||||
if (vchSecret.size() != 32)
|
||||
return false;
|
||||
CKey key;
|
||||
key.SetSecret(vchSecret);
|
||||
if (key.GetPubKey() == vchPubKey)
|
||||
@@ -131,6 +133,8 @@ bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const
|
||||
CSecret vchSecret;
|
||||
if (!DecryptSecret(vMasterKey, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret))
|
||||
return false;
|
||||
if (vchSecret.size() != 32)
|
||||
return false;
|
||||
keyOut.SetSecret(vchSecret);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user