public class GMUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private static EllipticCurve |
SM2_CURVE |
private static Set<String> |
SM2_CURVE_NAMES |
| 构造器和说明 |
|---|
GMUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static ECPoint |
add(ECPoint p1,
ECPoint p2) |
(专用程序包) static SM2P256V1Point |
add(SM2P256V1Point p1,
SM2P256V1Point p2)
U2 = lambda2
S2 = lambda5
U1 = lambda1
S1 = lambda4
H = U1 - U2 = lambda1 - lambda2 = lambda3
R = S1 - S2 = lambda4 - lambda5 = lambda6
G = H^3 = (lambda3)^3
V = H^2 * U1 = (lambda3)^2 * lambda1
G = -H^3 = -(lambda3)^3
tt1 = S1 * G = lambda4 * (- (lambda3)^3)
G = 2*V + G = 2 * (lambda3^2 * lambda1) + (-(lambda3)^3 )
= lambda3^2 (2 * lambda1 - lambda3)
= lambda3^2 ( 2 * lambda1 - (lambda1 - lambda2))
= lambda3^2 * (lambda1 + lambda2 )
= lambda3^2 * lambda7
X3 = R^2 - G = lambda6^2 - lambda7 *(lambda3)^2
Y3 = (V - X3) * R + tt1 = (lambda1 * (lambda3)^2 - X3) * lambda6 + (lambda4 * (- (lambda3)^3))
= lambda6 * (lambda1 * (lambda3)^2 - X3) - lambda4 * (lambda3)^3
Z3 = H * Z1 * Z2 = lambda3 * Z1 * Z2 = Z1 * Z2 * lambda3
|
static boolean |
checkECPoint(ECPoint ecPoint,
EllipticCurve curve)
Check if elliptic curve point is on target elliptic curve
|
static boolean |
isSM2Curve(AlgorithmParameterSpec params) |
static boolean |
isSM2Curve(EllipticCurve curve) |
static ECPoint |
multiply(ECPoint ecPoint,
BigInteger k,
EllipticCurve curve) |
static ECPoint |
multiply(ECPoint ecPoint,
int k,
EllipticCurve curve) |
(专用程序包) static SM2P256V1Point |
subtract(SM2P256V1Point p1,
SM2P256V1Point p2) |
(专用程序包) static SM2P256V1Point |
timesPow2(SM2P256V1Point p,
int e) |
private static SM2P256V1Point |
twice(SM2P256V1Point p1)
T = (Y1)^4
t2 = (Z1)^2
t1 = X1 - (Z1)^2
M = X1 + (Z1)^2
M = M * t1 = (X1)^2 - (Z1)^4
M = M + M + M = 3 * (X1)^2 - 3 *(Z1)^4 <==> Is it equivalent?
|
private static final EllipticCurve SM2_CURVE
public static boolean isSM2Curve(AlgorithmParameterSpec params)
public static boolean isSM2Curve(EllipticCurve curve)
public static boolean checkECPoint(ECPoint ecPoint, EllipticCurve curve)
ecPoint - curve - public static ECPoint multiply(ECPoint ecPoint, int k, EllipticCurve curve)
public static ECPoint multiply(ECPoint ecPoint, BigInteger k, EllipticCurve curve)
static SM2P256V1Point subtract(SM2P256V1Point p1, SM2P256V1Point p2)
static SM2P256V1Point timesPow2(SM2P256V1Point p, int e)
static SM2P256V1Point add(SM2P256V1Point p1, SM2P256V1Point p2)
private static SM2P256V1Point twice(SM2P256V1Point p1)
Copyright © 2024. All rights reserved.