aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/keystore.cpp')
-rw-r--r--src/keystore.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp
index e76f7790f1..23f9e32fa2 100644
--- a/src/keystore.cpp
+++ b/src/keystore.cpp
@@ -84,6 +84,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.SetPubKey(vchPubKey);
key.SetSecret(vchSecret);
@@ -146,6 +148,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.SetPubKey(vchPubKey);
keyOut.SetSecret(vchSecret);
return true;