mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 19:41:24 +00:00
ECKey: extend the comment about why private keys of zero and one are now forbidden
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user