}); BigInteger secondPrimeFactor = asBigInteger(json, PARAM_SECOND_PRIME_FACTOR, "RSA second prime factor"); BigInteger firstFactorCrtExp = asBigInteger(json, PARAM_FIRST_FACTOR_CRT_EXP, "RSA first factor CRT exponent"); BigInteger secondFactorCrtExp = asBigInteger(json, PARAM_SECOND_FACTOR_CRT_EXP, "RSA second factor CRT exponent"); BigInteger firstCrtCoeff = asBigInteger(json, PARAM_FIRST_CRT_COEFF, "RSA first CRT coefficient"); try { return kf.generatePrivate(new RSAPrivateCrtKeySpec(modulus,
/** * Update this builder from JWK in json format. * * @param json JsonObject with the JWK * @return updated builder instance, just call {@link #build()} to build the {@link JwkRSA} instance * @see JwkRSA#create(JsonObject) as a shortcut if no additional configuration is to be done */ public Builder fromJson(JsonObject json) { super.fromJson(json); // now RSA specific fields BigInteger modulus = asBigInteger(json, PARAM_PUB_MODULUS, "RSA modulus"); BigInteger publicExponent = asBigInteger(json, PARAM_PUB_EXP, "RSA exponent"); KeyFactory kf = getKeyFactory(SECURITY_ALGORITHM); this.privateKey = JwtUtil.getBigInteger(json, PARAM_EXP, "RSA private exponent") .map(d -> toPrivateKey(kf, modulus, publicExponent, d, json)) .orElse(null); this.publicKey = toPublicKey(kf, modulus, publicExponent); return this; }
BigInteger x = asBigInteger(json, PARAM_X_COORDINATE, "EC X Coordinate"); BigInteger y = asBigInteger(json, PARAM_Y_COODRINATE, "EC Y Coordinate");
/** * Update this builder from JWK in json format. * * @param json JsonObject with the JWK * @return updated builder instance, just call {@link #build()} to build the {@link JwkRSA} instance * @see JwkRSA#create(JsonObject) as a shortcut if no additional configuration is to be done */ public Builder fromJson(JsonObject json) { super.fromJson(json); // now RSA specific fields BigInteger modulus = asBigInteger(json, PARAM_PUB_MODULUS, "RSA modulus"); BigInteger publicExponent = asBigInteger(json, PARAM_PUB_EXP, "RSA exponent"); KeyFactory kf = getKeyFactory(SECURITY_ALGORITHM); this.privateKey = JwtUtil.getBigInteger(json, PARAM_EXP, "RSA private exponent") .map(d -> toPrivateKey(kf, modulus, publicExponent, d, json)) .orElse(null); this.publicKey = toPublicKey(kf, modulus, publicExponent); return this; }
}); BigInteger secondPrimeFactor = asBigInteger(json, PARAM_SECOND_PRIME_FACTOR, "RSA second prime factor"); BigInteger firstFactorCrtExp = asBigInteger(json, PARAM_FIRST_FACTOR_CRT_EXP, "RSA first factor CRT exponent"); BigInteger secondFactorCrtExp = asBigInteger(json, PARAM_SECOND_FACTOR_CRT_EXP, "RSA second factor CRT exponent"); BigInteger firstCrtCoeff = asBigInteger(json, PARAM_FIRST_CRT_COEFF, "RSA first CRT coefficient"); try { return kf.generatePrivate(new RSAPrivateCrtKeySpec(modulus,
BigInteger x = asBigInteger(json, PARAM_X_COORDINATE, "EC X Coordinate"); BigInteger y = asBigInteger(json, PARAM_Y_COODRINATE, "EC Y Coordinate");