use of com.github.zhenwei.provider.jcajce.provider.asymmetric.rsa.BCRSAPublicKey in project LinLong-Java by zhenwei1108.
the class KeyPairTest method genRsa1024Key.
@Test
public void genRsa1024Key() throws BaseWeGooException {
KeyBuilder builder = new KeyBuilder(new WeGooProvider());
KeyPair keyPair = builder.buildKeyPair(KeyPairAlgEnum.RSA_1024);
System.out.println(Base64Util.encode(keyPair.getPrivate().getEncoded()));
System.out.println(Base64Util.encode(keyPair.getPublic().getEncoded()));
BCRSAPublicKey aPublic = (BCRSAPublicKey) keyPair.getPublic();
// 大素数
System.out.println("modulus:" + aPublic.getModulus().toString());
BigInteger mod = aPublic.getModulus().mod(BigInteger.valueOf(128));
System.out.println(mod);
// 指数
System.out.println("exponent:" + aPublic.getPublicExponent().intValue());
}
Aggregations