Use the Montgomery ladder multiplier to avoid side-channel attacks.

This commit is contained in:
akwizgran
2014-03-19 22:52:53 +00:00
parent abfff10f6b
commit 007ddac880
3 changed files with 115 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import java.math.BigInteger;
import org.spongycastle.crypto.params.ECDomainParameters;
import org.spongycastle.math.ec.ECCurve;
import org.spongycastle.math.ec.ECPoint;
import org.spongycastle.math.ec.MontgomeryLadderMultiplier;
/** Parameters for curve brainpoolP384r1 - see RFC 5639. */
interface EllipticCurveConstants {
@@ -61,7 +62,8 @@ interface EllipticCurveConstants {
BigInteger H = BigInteger.ONE;
// Static parameter objects derived from the above parameters
ECCurve CURVE = new ECCurve.Fp(P, A, B);
ECCurve CURVE = new ECCurve.Fp(P, A, B).configure().setMultiplier(
new MontgomeryLadderMultiplier()).create();
ECPoint G = CURVE.createPoint(X, Y);
ECDomainParameters PARAMETERS = new ECDomainParameters(CURVE, G, Q, H);
}