org.apache.cxf.rs.security.jose.jwk
Class JwkUtils

java.lang.Object
  extended by org.apache.cxf.rs.security.jose.jwk.JwkUtils

public final class JwkUtils
extends Object


Field Summary
static String JWK_KEY_STORE_TYPE
           
static String RSSEC_KEY_STORE_JWKKEY
           
static String RSSEC_KEY_STORE_JWKSET
           
 
Method Summary
static JsonWebKey decodeJwkKey(String jwkJson)
           
static JsonWebKeys decodeJwkSet(String jwksJson)
           
static JsonWebKey decryptJwkKey(InputStream is, char[] password)
           
static JsonWebKey decryptJwkKey(InputStream is, char[] password, JwkReaderWriter reader)
           
static JsonWebKey decryptJwkKey(InputStream is, JweDecryptionProvider jwe, JwkReaderWriter reader)
           
static JsonWebKey decryptJwkKey(RSAPrivateKey key, String keyAlgo, String ctAlgo, String jsonJwk)
           
static JsonWebKey decryptJwkKey(SecretKey key, String keyAlgo, String ctAlgo, String jsonJwk)
           
static JsonWebKey decryptJwkKey(String jsonJwkKey, char[] password)
           
static JsonWebKey decryptJwkKey(String jsonJwkKey, char[] password, JwkReaderWriter reader)
           
static JsonWebKey decryptJwkKey(String jsonJwkKey, JweDecryptionProvider jwe, JwkReaderWriter reader)
           
static JsonWebKeys decryptJwkSet(InputStream is, char[] password)
           
static JsonWebKeys decryptJwkSet(InputStream is, char[] password, JwkReaderWriter reader)
           
static JsonWebKeys decryptJwkSet(InputStream is, JweDecryptionProvider jwe, JwkReaderWriter reader)
           
static JsonWebKeys decryptJwkSet(RSAPrivateKey key, String keyAlgo, String ctAlgo, String jsonJwkSet)
           
static JsonWebKeys decryptJwkSet(SecretKey key, String keyAlgo, String ctAlgo, String jsonJwkSet)
           
static JsonWebKeys decryptJwkSet(String jsonJwkSet, char[] password)
           
static JsonWebKeys decryptJwkSet(String jsonJwkSet, char[] password, JwkReaderWriter reader)
           
static JsonWebKeys decryptJwkSet(String jsonJwkSet, JweDecryptionProvider jwe, JwkReaderWriter reader)
           
static String encodeJwkKey(JsonWebKey jwkKey)
           
static String encodeJwkSet(JsonWebKeys jwkSet)
           
static String encryptJwkKey(JsonWebKey jwk, char[] password)
           
static String encryptJwkKey(JsonWebKey jwkKey, char[] password, JwkReaderWriter writer)
           
static String encryptJwkKey(JsonWebKey jwkKey, JweEncryptionProvider jwe, JwkReaderWriter writer)
           
static String encryptJwkKey(JsonWebKey jwkKey, RSAPublicKey key, String keyAlgo, String contentAlgo)
           
static String encryptJwkKey(JsonWebKey jwkKey, SecretKey key, String keyAlgo, String contentAlgo)
           
static String encryptJwkSet(JsonWebKeys jwkSet, char[] password)
           
static String encryptJwkSet(JsonWebKeys jwkSet, char[] password, JwkReaderWriter writer)
           
static String encryptJwkSet(JsonWebKeys jwkSet, JweEncryptionProvider jwe, JwkReaderWriter writer)
           
static String encryptJwkSet(JsonWebKeys jwkSet, RSAPublicKey key, String keyAlgo, String contentAlgo)
           
static String encryptJwkSet(JsonWebKeys jwkSet, SecretKey key, String keyAlgo, String contentAlgo)
           
static JsonWebKey fromECPrivateKey(ECPrivateKey pk, String curve)
           
static JsonWebKey fromECPublicKey(ECPublicKey pk, String curve)
           
static JsonWebKey fromRSAPrivateKey(RSAPrivateKey pk, String algo)
           
static JsonWebKey fromRSAPublicKey(RSAPublicKey pk, String algo)
           
static JsonWebKey fromSecretKey(SecretKey secretKey, String algo)
           
static JsonWebKey fromX509CertificateChain(List<X509Certificate> chain, String algo)
           
static String jwkKeyToJson(JsonWebKey jwkKey)
           
static String jwkSetToJson(JsonWebKeys jwkSet)
           
static JsonWebKey loadJsonWebKey(org.apache.cxf.message.Message m, Properties props, String keyOper)
           
static JsonWebKey loadJsonWebKey(org.apache.cxf.message.Message m, Properties props, String keyOper, JwkReaderWriter reader)
           
static List<JsonWebKey> loadJsonWebKeys(org.apache.cxf.message.Message m, Properties props, String keyOper)
           
static List<JsonWebKey> loadJsonWebKeys(org.apache.cxf.message.Message m, Properties props, String keyOper, JwkReaderWriter reader)
           
static JsonWebKeys loadJwkSet(org.apache.cxf.message.Message m, Properties props, PrivateKeyPasswordProvider cb)
           
static JsonWebKeys loadJwkSet(org.apache.cxf.message.Message m, Properties props, PrivateKeyPasswordProvider cb, JwkReaderWriter reader)
           
static JsonWebKeys loadJwkSet(Properties props, org.apache.cxf.Bus bus, JweDecryptionProvider jwe, JwkReaderWriter reader)
           
static JsonWebKeys loadJwkSet(Properties props, org.apache.cxf.Bus bus, PrivateKeyPasswordProvider cb)
           
static JsonWebKeys loadJwkSet(Properties props, org.apache.cxf.Bus bus, PrivateKeyPasswordProvider cb, JwkReaderWriter reader)
           
static JsonWebKey readJwkKey(InputStream is)
           
static JsonWebKey readJwkKey(String jwkJson)
           
static JsonWebKey readJwkKey(URI uri)
           
static JsonWebKeys readJwkSet(InputStream is)
           
static JsonWebKeys readJwkSet(String jwksJson)
           
static JsonWebKeys readJwkSet(URI uri)
           
static void setPublicKeyInfo(JsonWebKey jwk, JoseHeaders headers, String algo)
           
static String signJwkKey(JsonWebKey jwkKey, RSAPrivateKey key, String algo)
           
static String signJwkSet(JsonWebKeys jwkSet, RSAPrivateKey key, String algo)
           
static ECPrivateKey toECPrivateKey(JsonWebKey jwk)
           
static ECPublicKey toECPublicKey(JsonWebKey jwk)
           
static RSAPrivateKey toRSAPrivateKey(JsonWebKey jwk)
           
static RSAPublicKey toRSAPublicKey(JsonWebKey jwk)
           
static RSAPublicKey toRSAPublicKey(JsonWebKey jwk, boolean checkX509)
           
static SecretKey toSecretKey(JsonWebKey jwk)
           
static List<X509Certificate> toX509CertificateChain(JsonWebKey jwk)
           
static JsonWebKey verifyJwkKey(RSAPublicKey key, String keyAlgo, String jsonJwk)
           
static JsonWebKeys verifyJwkSet(RSAPublicKey key, String keyAlgo, String jsonJwk)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JWK_KEY_STORE_TYPE

public static final String JWK_KEY_STORE_TYPE
See Also:
Constant Field Values

RSSEC_KEY_STORE_JWKSET

public static final String RSSEC_KEY_STORE_JWKSET
See Also:
Constant Field Values

RSSEC_KEY_STORE_JWKKEY

public static final String RSSEC_KEY_STORE_JWKKEY
See Also:
Constant Field Values
Method Detail

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)

jwkSetToJson

public static String jwkSetToJson(JsonWebKeys jwkSet)

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,
                                   char[] password,
                                   JwkReaderWriter writer)

encryptJwkSet

public static String encryptJwkSet(JsonWebKeys jwkSet,
                                   JweEncryptionProvider jwe,
                                   JwkReaderWriter writer)

encryptJwkSet

public static String encryptJwkSet(JsonWebKeys jwkSet,
                                   RSAPublicKey key,
                                   String keyAlgo,
                                   String contentAlgo)

signJwkSet

public static String signJwkSet(JsonWebKeys jwkSet,
                                RSAPrivateKey key,
                                String algo)

encryptJwkSet

public static String encryptJwkSet(JsonWebKeys jwkSet,
                                   SecretKey key,
                                   String keyAlgo,
                                   String contentAlgo)

decryptJwkSet

public static JsonWebKeys decryptJwkSet(String jsonJwkSet,
                                        char[] password)

decryptJwkSet

public static JsonWebKeys decryptJwkSet(String jsonJwkSet,
                                        char[] password,
                                        JwkReaderWriter reader)

decryptJwkSet

public static JsonWebKeys decryptJwkSet(String jsonJwkSet,
                                        JweDecryptionProvider jwe,
                                        JwkReaderWriter reader)

decryptJwkSet

public static JsonWebKeys decryptJwkSet(RSAPrivateKey key,
                                        String keyAlgo,
                                        String ctAlgo,
                                        String jsonJwkSet)

verifyJwkSet

public static JsonWebKeys verifyJwkSet(RSAPublicKey key,
                                       String keyAlgo,
                                       String jsonJwk)

decryptJwkSet

public static JsonWebKeys decryptJwkSet(SecretKey key,
                                        String keyAlgo,
                                        String ctAlgo,
                                        String jsonJwkSet)

decryptJwkSet

public static JsonWebKeys decryptJwkSet(InputStream is,
                                        char[] password)
                                 throws IOException
Throws:
IOException

decryptJwkSet

public static JsonWebKeys decryptJwkSet(InputStream is,
                                        char[] password,
                                        JwkReaderWriter reader)
                                 throws IOException
Throws:
IOException

decryptJwkSet

public static JsonWebKeys decryptJwkSet(InputStream is,
                                        JweDecryptionProvider jwe,
                                        JwkReaderWriter reader)
                                 throws IOException
Throws:
IOException

encryptJwkKey

public static String encryptJwkKey(JsonWebKey jwk,
                                   char[] password)

encryptJwkKey

public static String encryptJwkKey(JsonWebKey jwkKey,
                                   char[] password,
                                   JwkReaderWriter writer)

encryptJwkKey

public static String encryptJwkKey(JsonWebKey jwkKey,
                                   JweEncryptionProvider jwe,
                                   JwkReaderWriter writer)

encryptJwkKey

public static String encryptJwkKey(JsonWebKey jwkKey,
                                   RSAPublicKey key,
                                   String keyAlgo,
                                   String contentAlgo)

encryptJwkKey

public static String encryptJwkKey(JsonWebKey jwkKey,
                                   SecretKey key,
                                   String keyAlgo,
                                   String contentAlgo)

signJwkKey

public static String signJwkKey(JsonWebKey jwkKey,
                                RSAPrivateKey key,
                                String algo)

decryptJwkKey

public static JsonWebKey decryptJwkKey(String jsonJwkKey,
                                       char[] password)

decryptJwkKey

public static JsonWebKey decryptJwkKey(String jsonJwkKey,
                                       char[] password,
                                       JwkReaderWriter reader)

decryptJwkKey

public static JsonWebKey decryptJwkKey(RSAPrivateKey key,
                                       String keyAlgo,
                                       String ctAlgo,
                                       String jsonJwk)

verifyJwkKey

public static JsonWebKey verifyJwkKey(RSAPublicKey key,
                                      String keyAlgo,
                                      String jsonJwk)

decryptJwkKey

public static JsonWebKey decryptJwkKey(SecretKey key,
                                       String keyAlgo,
                                       String ctAlgo,
                                       String jsonJwk)

decryptJwkKey

public static JsonWebKey decryptJwkKey(String jsonJwkKey,
                                       JweDecryptionProvider jwe,
                                       JwkReaderWriter reader)

decryptJwkKey

public static JsonWebKey decryptJwkKey(InputStream is,
                                       char[] password)
                                throws IOException
Throws:
IOException

decryptJwkKey

public static JsonWebKey decryptJwkKey(InputStream is,
                                       char[] password,
                                       JwkReaderWriter reader)
                                throws IOException
Throws:
IOException

decryptJwkKey

public static JsonWebKey decryptJwkKey(InputStream is,
                                       JweDecryptionProvider jwe,
                                       JwkReaderWriter reader)
                                throws IOException
Throws:
IOException

loadJwkSet

public static JsonWebKeys loadJwkSet(org.apache.cxf.message.Message m,
                                     Properties props,
                                     PrivateKeyPasswordProvider cb)

loadJwkSet

public static JsonWebKeys loadJwkSet(org.apache.cxf.message.Message m,
                                     Properties props,
                                     PrivateKeyPasswordProvider cb,
                                     JwkReaderWriter reader)

loadJwkSet

public static JsonWebKeys loadJwkSet(Properties props,
                                     org.apache.cxf.Bus bus,
                                     PrivateKeyPasswordProvider cb)

loadJwkSet

public static JsonWebKeys loadJwkSet(Properties props,
                                     org.apache.cxf.Bus bus,
                                     PrivateKeyPasswordProvider cb,
                                     JwkReaderWriter reader)

loadJwkSet

public static JsonWebKeys loadJwkSet(Properties props,
                                     org.apache.cxf.Bus bus,
                                     JweDecryptionProvider jwe,
                                     JwkReaderWriter reader)

loadJsonWebKey

public static JsonWebKey loadJsonWebKey(org.apache.cxf.message.Message m,
                                        Properties props,
                                        String keyOper)

loadJsonWebKey

public static JsonWebKey loadJsonWebKey(org.apache.cxf.message.Message m,
                                        Properties props,
                                        String keyOper,
                                        JwkReaderWriter reader)

loadJsonWebKeys

public static List<JsonWebKey> loadJsonWebKeys(org.apache.cxf.message.Message m,
                                               Properties props,
                                               String keyOper)

loadJsonWebKeys

public static List<JsonWebKey> loadJsonWebKeys(org.apache.cxf.message.Message m,
                                               Properties props,
                                               String keyOper,
                                               JwkReaderWriter reader)

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)

fromECPrivateKey

public static JsonWebKey fromECPrivateKey(ECPrivateKey pk,
                                          String curve)

fromRSAPublicKey

public static JsonWebKey fromRSAPublicKey(RSAPublicKey pk,
                                          String algo)

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)

toECPublicKey

public static ECPublicKey toECPublicKey(JsonWebKey jwk)

toECPrivateKey

public static ECPrivateKey toECPrivateKey(JsonWebKey jwk)

toSecretKey

public static SecretKey toSecretKey(JsonWebKey jwk)

fromSecretKey

public static JsonWebKey fromSecretKey(SecretKey secretKey,
                                       String algo)

setPublicKeyInfo

public static void setPublicKeyInfo(JsonWebKey jwk,
                                    JoseHeaders headers,
                                    String algo)


Apache CXF