use of java.security.spec.RSAPrivateCrtKeySpec in project tink by google.
the class SelfKeyTestValidatorsTest method createRsaKey.
private final void createRsaKey(int bitLength) throws Exception {
String[] keyInfo = getRsaKeyInfo(bitLength);
KeyFactory kf = EngineFactory.KEY_FACTORY.getInstance("RSA");
publicRsaKey = (RSAPublicKey) kf.generatePublic(new RSAPublicKeySpec(new BigInteger(keyInfo[0].substring(keyInfo[0].length() - (bitLength / 4)), 16), BigInteger.valueOf(65537)));
privateRsaKey = (RSAPrivateCrtKey) kf.generatePrivate(new RSAPrivateCrtKeySpec(new BigInteger(keyInfo[0], 16), BigInteger.valueOf(65537), new BigInteger(keyInfo[1], 16), new BigInteger(keyInfo[2], 16), new BigInteger(keyInfo[3], 16), new BigInteger(keyInfo[4], 16), new BigInteger(keyInfo[5], 16), new BigInteger(keyInfo[6], 16)));
}
Aggregations