Class JwkUtils
- java.lang.Object
-
- org.apache.cxf.rs.security.jose.jwk.JwkUtils
-
public final class JwkUtils extends Object
-
-
Method Summary
-
-
-
Method Detail
-
getThumbprint
public static String getThumbprint(JsonWebKey key)
-
readJwkKey
public static JsonWebKey readJwkKey(URI uri) throws IOException
- Throws:
IOException
-
readJwkSet
public static JsonWebKeys readJwkSet(URI uri) throws IOException
- Throws:
IOException
-
readJwkKey
public static JsonWebKey readJwkKey(InputStream is) throws IOException
- Throws:
IOException
-
readJwkSet
public static JsonWebKeys readJwkSet(InputStream is) throws IOException
- Throws:
IOException
-
readJwkKey
public static JsonWebKey readJwkKey(String jwkJson)
-
readJwkSet
public static JsonWebKeys readJwkSet(String jwksJson)
-
jwkKeyToJson
public static String jwkKeyToJson(JsonWebKey jwkKey)
-
jwkKeyToJson
public static void jwkKeyToJson(JsonWebKey jwkKey, OutputStream os) throws IOException
- Throws:
IOException
-
jwkSetToJson
public static String jwkSetToJson(JsonWebKeys jwkSet)
-
jwkSetToJson
public static void jwkSetToJson(JsonWebKeys jwkSet, OutputStream os) throws IOException
- Throws:
IOException
-
encodeJwkKey
public static String encodeJwkKey(JsonWebKey jwkKey)
-
encodeJwkSet
public static String encodeJwkSet(JsonWebKeys jwkSet)
-
decodeJwkKey
public static JsonWebKey decodeJwkKey(String jwkJson)
-
decodeJwkSet
public static JsonWebKeys decodeJwkSet(String jwksJson)
-
encryptJwkSet
public static String encryptJwkSet(JsonWebKeys jwkSet, char[] password)
-
encryptJwkSet
public static String encryptJwkSet(JsonWebKeys jwkSet, JweEncryptionProvider jwe)
-
encryptJwkSet
public static String encryptJwkSet(JsonWebKeys jwkSet, PublicKey key, KeyAlgorithm keyAlgo, ContentAlgorithm contentAlgo)
-
signJwkSet
public static String signJwkSet(JsonWebKeys jwkSet, PrivateKey key, SignatureAlgorithm algo)
-
encryptJwkSet
public static String encryptJwkSet(JsonWebKeys jwkSet, SecretKey key, KeyAlgorithm keyAlgo, ContentAlgorithm contentAlgo)
-
decryptJwkSet
public static JsonWebKeys decryptJwkSet(String jsonJwkSet, char[] password)
-
decryptJwkSet
public static JsonWebKeys decryptJwkSet(String jsonJwkSet, JweDecryptionProvider jwe)
-
decryptJwkSet
public static JsonWebKeys decryptJwkSet(PrivateKey key, KeyAlgorithm keyAlgo, ContentAlgorithm ctAlgo, String jsonJwkSet)
-
verifyJwkSet
public static JsonWebKeys verifyJwkSet(PublicKey key, SignatureAlgorithm keyAlgo, String jsonJwk)
-
decryptJwkSet
public static JsonWebKeys decryptJwkSet(SecretKey key, KeyAlgorithm keyAlgo, ContentAlgorithm ctAlgo, String jsonJwkSet)
-
decryptJwkSet
public static JsonWebKeys decryptJwkSet(InputStream is, char[] password) throws IOException
- Throws:
IOException
-
decryptJwkSet
public static JsonWebKeys decryptJwkSet(InputStream is, JweDecryptionProvider jwe) throws IOException
- Throws:
IOException
-
encryptJwkKey
public static String encryptJwkKey(JsonWebKey jwkKey, char[] password)
-
encryptJwkKey
public static String encryptJwkKey(JsonWebKey jwkKey, JweEncryptionProvider jwe)
-
encryptJwkKey
public static String encryptJwkKey(JsonWebKey jwkKey, PublicKey key, KeyAlgorithm keyAlgo, ContentAlgorithm contentAlgo)
-
encryptJwkKey
public static String encryptJwkKey(JsonWebKey jwkKey, SecretKey key, KeyAlgorithm keyAlgo, ContentAlgorithm contentAlgo)
-
signJwkKey
public static String signJwkKey(JsonWebKey jwkKey, PrivateKey key, SignatureAlgorithm algo)
-
decryptJwkKey
public static JsonWebKey decryptJwkKey(String jsonJwkKey, char[] password)
-
decryptJwkKey
public static JsonWebKey decryptJwkKey(PrivateKey key, KeyAlgorithm keyAlgo, ContentAlgorithm ctAlgo, String jsonJwk)
-
verifyJwkKey
public static JsonWebKey verifyJwkKey(PublicKey key, SignatureAlgorithm keyAlgo, String jsonJwk)
-
decryptJwkKey
public static JsonWebKey decryptJwkKey(SecretKey key, KeyAlgorithm keyAlgo, ContentAlgorithm ctAlgo, String jsonJwk)
-
decryptJwkKey
public static JsonWebKey decryptJwkKey(String jsonJwkKey, JweDecryptionProvider jwe)
-
decryptJwkKey
public static JsonWebKey decryptJwkKey(InputStream is, char[] password) throws IOException
- Throws:
IOException
-
decryptJwkKey
public static JsonWebKey decryptJwkKey(InputStream is, JweDecryptionProvider jwe) throws IOException
- Throws:
IOException
-
loadPublicJwkSet
public static JsonWebKeys loadPublicJwkSet(Message m, Properties props)
-
loadJwkSet
public static JsonWebKeys loadJwkSet(Message m, Properties props, PrivateKeyPasswordProvider cb)
-
loadJwkSet
public static JsonWebKeys loadJwkSet(Properties props, Bus bus, PrivateKeyPasswordProvider cb)
-
loadJwkSet
public static JsonWebKeys loadJwkSet(Properties props, Bus bus, JweDecryptionProvider jwe)
-
loadJsonWebKey
public static JsonWebKey loadJsonWebKey(Message m, Properties props, KeyOperation keyOper)
-
loadJsonWebKey
public static JsonWebKey loadJsonWebKey(Message m, Properties props, KeyOperation keyOper, String inHeaderKid)
-
loadJsonWebKeys
public static List<JsonWebKey> loadJsonWebKeys(Message m, Properties props, KeyOperation keyOper)
-
loadJsonWebKeys
public static List<JsonWebKey> loadJsonWebKeys(Message m, Properties props, KeyOperation keyOper, PrivateKeyPasswordProvider cb)
-
toRSAPublicKey
public static RSAPublicKey toRSAPublicKey(JsonWebKey jwk)
-
toRSAPublicKey
public static RSAPublicKey toRSAPublicKey(JsonWebKey jwk, boolean checkX509)
-
toX509CertificateChain
public static List<X509Certificate> toX509CertificateChain(JsonWebKey jwk)
-
fromECPublicKey
public static JsonWebKey fromECPublicKey(ECPublicKey pk, String curve)
-
fromECPublicKey
public static JsonWebKey fromECPublicKey(ECPublicKey pk, String curve, String kid)
-
fromECPrivateKey
public static JsonWebKey fromECPrivateKey(ECPrivateKey pk, String curve)
-
fromECPrivateKey
public static JsonWebKey fromECPrivateKey(ECPrivateKey pk, String curve, String kid)
-
fromRSAPublicKey
public static JsonWebKey fromRSAPublicKey(RSAPublicKey pk, String algo)
-
fromRSAPublicKey
public static JsonWebKey fromRSAPublicKey(RSAPublicKey pk, String algo, String kid)
-
fromPublicKey
public static JsonWebKey fromPublicKey(PublicKey key, Properties props, String algoProp)
-
fromX509CertificateChain
public static JsonWebKey fromX509CertificateChain(List<X509Certificate> chain, String algo)
-
toRSAPrivateKey
public static RSAPrivateKey toRSAPrivateKey(JsonWebKey jwk)
-
fromRSAPrivateKey
public static JsonWebKey fromRSAPrivateKey(RSAPrivateKey pk, String algo)
-
fromRSAPrivateKey
public static JsonWebKey fromRSAPrivateKey(RSAPrivateKey pk, String algo, String kid)
-
toECPublicKey
public static ECPublicKey toECPublicKey(JsonWebKey jwk)
-
toECPrivateKey
public static ECPrivateKey toECPrivateKey(JsonWebKey jwk)
-
toSecretKey
public static SecretKey toSecretKey(JsonWebKey jwk)
-
toSecretKey
public static SecretKey toSecretKey(JsonWebKey jwk, KeyAlgorithm algorithm)
-
fromSecretKey
public static JsonWebKey fromSecretKey(SecretKey secretKey, String algo)
-
fromSecretKey
public static JsonWebKey fromSecretKey(SecretKey secretKey, String algo, String kid)
-
includeCertChain
public static void includeCertChain(JsonWebKey jwk, JoseHeaders headers, String algo)
-
includePublicKey
public static void includePublicKey(JsonWebKey jwk, JoseHeaders headers, String algo)
-
stripPrivateParameters
public static List<JsonWebKey> stripPrivateParameters(List<JsonWebKey> keys)
-
-