use of com.github.zhenwei.sdk.builder.SignBuilder in project LinLong-Java by zhenwei1108.
the class KeyPairTest method genSM2Key.
@Test
public void genSM2Key() throws BaseWeGooException {
KeyBuilder builder = new KeyBuilder(new WeGooProvider());
KeyPair keyPair = builder.buildKeyPair(KeyPairAlgEnum.SM2_256);
System.out.println(Base64Util.encode(keyPair.getPrivate().getEncoded()));
System.out.println(Base64Util.encode(keyPair.getPublic().getEncoded()));
SignBuilder signBuilder = new SignBuilder(new WeGooProvider());
byte[] signatureSourceData = signBuilder.signatureSourceData(SignAlgEnum.SM3_WITH_SM2, keyPair.getPrivate(), "sadfadf".getBytes(StandardCharsets.UTF_8));
System.out.println(Base64Util.encode(signatureSourceData));
}
use of com.github.zhenwei.sdk.builder.SignBuilder in project LinLong-Java by zhenwei1108.
the class RealSignerTest method readSigner.
@Test
public void readSigner() throws BaseWeGooException {
WeGooProvider weGooProvider = new WeGooProvider();
SignBuilder signBuilder = new SignBuilder(weGooProvider);
KeyBuilder keyBuilder = new KeyBuilder(weGooProvider);
KeyPair keyPair = keyBuilder.buildKeyPair(KeyPairAlgEnum.RSA_1024);
byte[] data = signBuilder.signatureSourceData(SignAlgEnum.SHA256_WITH_RSA, keyPair.getPrivate(), "asdfa".getBytes(StandardCharsets.UTF_8));
System.out.println(Hex.toHexString(data));
}
Aggregations