mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 06:47:54 +01:00
ECKey: extend the comment about why private keys of zero and one are now forbidden
This commit is contained in:
parent
fd10654143
commit
f1f07df11b
1 changed files with 3 additions and 1 deletions
|
@ -183,7 +183,9 @@ public class ECKey implements EncryptableItem, Serializable {
|
|||
|
||||
protected ECKey(@Nullable BigInteger priv, ECPoint pub) {
|
||||
if (priv != null) {
|
||||
// Try and catch buggy callers or bad key imports, etc.
|
||||
// Try and catch buggy callers or bad key imports, etc. Zero and one are special because these are often
|
||||
// used as sentinel values and because scripting languages have a habit of auto-casting true and false to
|
||||
// 1 and 0 or vice-versa. Type confusion bugs could therefore result in private keys with these values.
|
||||
checkArgument(!priv.equals(BigInteger.ZERO));
|
||||
checkArgument(!priv.equals(BigInteger.ONE));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue