简体   繁体   中英

How to create a BCRSAPrivateCrtKey object using CRT parameters?

For my CA there is a database running in the background storing RSA keys by their CRT parameters. Now a BCRSAPrivateCrtKey object shall be created by using the stored information in the database.

Hopefully you can help.

So is there any way to create a key object by using:

RSAPrivateCrtKeyParameters param = new RSAPrivateCrtKeyParameters(modulus,
        publicExponent, privateExponent, p, q, dP, dQ, qInv);
RSAPrivateCrtKeySpec prvkeySpec = new RSAPrivateCrtKeySpec(
        modulus, publicExponent, privateExponent, primeP,
        primeQ, primeExponentP, primeExponentQ,
        crtCoefficient);
Security.addProvider(new org.bouncycastle.jce
        .provider.BouncyCastleProvider());
KeyFactory kfact = KeyFactory.getInstance("RSA", "BC");
BCRSAPrivateCrtKey prk = (BCRSAPrivateCrtKey) kfact
       .generatePrivate(prvkeySpec);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM