椭圆曲线test
import java.math.*;
import java.util.Scanner;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.math.ec.*;
public class testECC {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
BigInteger p = scan.nextBigInteger();
BigInteger a = scan.nextBigInteger();
BigInteger b = scan.nextBigInteger();
BigInteger gx = scan.nextBigInteger();
BigInteger gy = scan.nextBigInteger();
BigInteger n = scan.nextBigInteger();
BigInteger k = scan.nextBigInteger();
ECCurve.Fp curve = new ECCurve.Fp(p, a, b);
ECPoint G = curve.createPoint(gx,gy);
ECDomainParameters ecc_para = new ECDomainParameters(curve,G,n);
System.out.println(G.toString()); //十六机制坐标表示
System.out.println(G.getXCoord().toBigInteger().toString(10)+" "+G.getYCoord().toBigInteger().toString(10));
ECPoint point = G.multiply(k).normalize(); //normalize()函数的作用是将其转化为仿射坐标系的坐标表示,单位向量为(1,1)
System.out.println(point.getXCoord().toBigInteger().toString(10));
point.normalize();
System.out.println(point);
}
}
Overview (Bouncy Castle Library 1.37 API Specification) (berkeley.edu)