You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PROBLEM: The if condition in the following function (crypto/KeyTools.java) seems incorrect. Comparing the bitLength() of two values should not be the criterion to do a modulo.
private static ECPoint getPublicPointFromPrivate(BigInteger privateKeyPoint) {
if (privateKeyPoint.bitLength() > CURVE.getN().bitLength()) {
privateKeyPoint = privateKeyPoint.mod(CURVE.getN());
}
return new FixedPointCombMultiplier().multiply(CURVE.getG(), privateKeyPoint);
}
SOLUTION: Instead of comparing the bitLength(), one should compare the actual values. In fact, one could throw an error if the input is larger than CURVE.N. Since this function is used to generate a public key from a private key, one should also do some extra checks on the input such as the input is 1) positive 2) not equal to 0. @nickcen@iantanwx
The text was updated successfully, but these errors were encountered:
PROBLEM: The
if
condition in the following function (crypto/KeyTools.java
) seems incorrect. Comparing thebitLength()
of two values should not be the criterion to do a modulo.SOLUTION: Instead of comparing the
bitLength()
, one should compare the actual values. In fact, one could throw an error if the input is larger thanCURVE.N
. Since this function is used to generate a public key from a private key, one should also do some extra checks on the input such as the input is 1) positive 2) not equal to 0. @nickcen @iantanwxThe text was updated successfully, but these errors were encountered: