mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-12 02:18:01 +00:00
DeterministicKey: throw a KeyCrypterException instead of an IllegalStateException if the derivation check fails (as this can happen when the password is wrong)
This commit is contained in:
committed by
Andreas Schildbach
parent
6ce2c58712
commit
79d2488f01
@@ -433,7 +433,10 @@ public class DeterministicKey extends ECKey {
|
|||||||
downCursor = HDKeyDerivation.deriveChildKey(downCursor, num);
|
downCursor = HDKeyDerivation.deriveChildKey(downCursor, num);
|
||||||
}
|
}
|
||||||
// downCursor is now the same key as us, but with private key bytes.
|
// downCursor is now the same key as us, but with private key bytes.
|
||||||
checkState(downCursor.pub.equals(pub));
|
// If it's not, it means we tried decrypting with an invalid password and earlier checks e.g. for padding didn't
|
||||||
|
// catch it.
|
||||||
|
if (!downCursor.pub.equals(pub))
|
||||||
|
throw new KeyCrypterException("Could not decrypt bytes");
|
||||||
return checkNotNull(downCursor.priv);
|
return checkNotNull(downCursor.priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user