protected ECCurve cloneCurve() { return new SM2P256V1Curve(); }
public SM2P256V1Curve() { super(q); this.infinity = new SM2P256V1Point(this, null, null); this.a = fromBigInteger(new BigInteger(1, Hex.decode("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC"))); this.b = fromBigInteger(new BigInteger(1, Hex.decode("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93"))); this.order = new BigInteger(1, Hex.decode("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123")); this.cofactor = BigInteger.valueOf(1); this.coord = SM2P256V1_DEFAULT_COORDS; }
public ECPoint lookup(int index) { int[] x = Nat256.create(), y = Nat256.create(); int pos = 0; for (int i = 0; i < len; ++i) { int MASK = ((i ^ index) - 1) >> 31; for (int j = 0; j < FE_INTS; ++j) { x[j] ^= table[pos + j] & MASK; y[j] ^= table[pos + FE_INTS + j] & MASK; } pos += (FE_INTS * 2); } return createRawPoint(new SM2P256V1FieldElement(x), new SM2P256V1FieldElement(y), false); } };
protected X9ECParameters createParameters() { byte[] S = null; ECCurve curve = configureCurve(new SM2P256V1Curve()); X9ECPoint G = new X9ECPoint(curve, Hex.decode("04" + "32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7" + "BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0")); return new X9ECParameters(curve, G, curve.getOrder(), curve.getCofactor(), S); } };