Trisia / alg-sm2-demo

SM2密码算法 JAVA 调用演示程序。
90 stars 45 forks source link

optimize generate sm2 keypair #1

Closed Gsealy closed 5 years ago

Gsealy commented 5 years ago

https://github.com/Trisia/alg-sm2-demo/blob/eb3d231804bd2b2c5aa6966c4899f56af1d792f8/src/main/java/edu/hznu/crypto/algsm2demo/SM2KeyGenerateFactory.java#L34

you can use blow code:

final ECGenParameterSpec ecGenSpec = new ECGenParameterSpec("sm2p256v1");
final KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC","BC");
kpg.initialize(ecGenSpec);
final KeyPair kp = kpg.generateKeyPair();

BR, Gsealy

Trisia commented 5 years ago

https://github.com/Trisia/alg-sm2-demo/blob/eb3d231804bd2b2c5aa6966c4899f56af1d792f8/src/main/java/edu/hznu/crypto/algsm2demo/SM2KeyGenerateFactory.java#L34

you can use blow code:

final ECGenParameterSpec ecGenSpec = new ECGenParameterSpec("sm2p256v1");
final KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC","BC");
kpg.initialize(ecGenSpec);
final KeyPair kp = kpg.generateKeyPair();

BR, Gsealy

wow, thank you