private PublicKey getPublic() throws JoseException, InvalidKeySpecException { RsaKeyUtil rsaKeyUtil = new RsaKeyUtil(); return rsaKeyUtil.fromPemEncoded(config.getPublicKey()); }
public static RsaJsonWebKey generateJwk(int bits, String provider, SecureRandom secureRandom) throws JoseException { RsaKeyUtil keyUtil = new RsaKeyUtil(provider, secureRandom); KeyPair keyPair = keyUtil.generateKeyPair(bits); RsaJsonWebKey rsaJwk = (RsaJsonWebKey) PublicJsonWebKey.Factory.newPublicJwk(keyPair.getPublic()); rsaJwk.setPrivateKey(keyPair.getPrivate()); return rsaJwk; } }
public RSAPrivateKey getRsaPrivateKey(RSAPrivateKeySpec keySpec) throws JoseException { try { PrivateKey privateKey = getKeyFactory().generatePrivate(keySpec); return (RSAPrivateKey) privateKey; } catch (InvalidKeySpecException e) { throw new JoseException("Invalid key spec: " + e, e); } }
RsaKeyUtil rsaKeyUtil = new RsaKeyUtil(jcaProvider, null); key = rsaKeyUtil.publicKey(modulus, publicExponent); checkForBareKeyCertMismatch(); BigInteger dq = getBigIntFromBase64UrlEncodedParam(params, SECOND_FACTOR_CRT_EXPONENT_MEMBER_NAME, false); BigInteger qi = getBigIntFromBase64UrlEncodedParam(params, FIRST_CRT_COEFFICIENT_MEMBER_NAME, false); privateKey = rsaKeyUtil.privateKey(modulus, publicExponent, d, p, q, dp, dq, qi); privateKey = rsaKeyUtil.privateKey(modulus, d);
public RSAPrivateKey privateKey(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger primeExponentP, BigInteger primeExponentQ, BigInteger crtCoefficient) throws JoseException { RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(modulus, publicExponent, privateExponent, primeP, primeQ, primeExponentP, primeExponentQ, crtCoefficient); return getRsaPrivateKey(keySpec); }
public KeyPair generateKeyPair(int bits) throws JoseException { KeyPairGenerator keyGenerator = getKeyPairGenerator(); if (secureRandom == null) { keyGenerator.initialize(bits); } else { keyGenerator.initialize(bits, secureRandom); } return keyGenerator.generateKeyPair(); } }
public RSAPrivateKey privateKey(BigInteger modulus, BigInteger privateExponent) throws JoseException { RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(modulus, privateExponent); return getRsaPrivateKey(keySpec); }
private PublicKey getPublic() throws JoseException, InvalidKeySpecException { RsaKeyUtil rsaKeyUtil = new RsaKeyUtil(); return rsaKeyUtil.fromPemEncoded(config.getPublicKey()); }
public RSAPublicKey publicKey(BigInteger modulus, BigInteger publicExponent) throws JoseException { RSAPublicKeySpec rsaPublicKeySpec = new RSAPublicKeySpec(modulus, publicExponent); try { PublicKey publicKey = getKeyFactory().generatePublic(rsaPublicKeySpec); return (RSAPublicKey) publicKey; } catch (InvalidKeySpecException e) { throw new JoseException("Invalid key spec: " + e, e); } }
return new RsaKeyUtil().fromPemEncoded(keyValue); } else { throw new IllegalArgumentException(
"-----END PUBLIC KEY-----"; RsaKeyUtil rsaKeyUtil = new RsaKeyUtil(); PublicKey publicKey = rsaKeyUtil.fromPemEncoded(publicKeyPEM);