Search in sources :

Example 11 with KeyBuilder

use of com.github.zhenwei.sdk.builder.KeyBuilder 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));
}
Also used : KeyBuilder(com.github.zhenwei.sdk.builder.KeyBuilder) KeyPair(java.security.KeyPair) SignBuilder(com.github.zhenwei.sdk.builder.SignBuilder) WeGooProvider(com.github.zhenwei.provider.jce.provider.WeGooProvider) Test(org.junit.Test)

Aggregations

WeGooProvider (com.github.zhenwei.provider.jce.provider.WeGooProvider)11 KeyBuilder (com.github.zhenwei.sdk.builder.KeyBuilder)11 Test (org.junit.Test)10 KeyPair (java.security.KeyPair)6 BCRSAPublicKey (com.github.zhenwei.provider.jcajce.provider.asymmetric.rsa.BCRSAPublicKey)3 P10Builder (com.github.zhenwei.sdk.builder.P10Builder)2 SignBuilder (com.github.zhenwei.sdk.builder.SignBuilder)2 CertBuilder (com.github.zhenwei.sdk.builder.CertBuilder)1 CipherBuilder (com.github.zhenwei.sdk.builder.CipherBuilder)1 HashBuilder (com.github.zhenwei.sdk.builder.HashBuilder)1 KeyStoreBuilder (com.github.zhenwei.sdk.builder.KeyStoreBuilder)1 CertExtension (com.github.zhenwei.sdk.builder.params.CertExtension)1 DigestParams (com.github.zhenwei.sdk.builder.params.DigestParams)1 BigInteger (java.math.BigInteger)1 X509Certificate (java.security.cert.X509Certificate)1 ArrayList (java.util.ArrayList)1 IvParameterSpec (javax.crypto.spec.IvParameterSpec)1