cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Renaming JWE key decryption interfaces to make the names consistent with encryption ones
Date Thu, 06 Aug 2015 22:47:21 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 1591faf1b -> 63d985869


Renaming JWE key decryption interfaces to make the names consistent with encryption ones


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/63d98586
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/63d98586
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/63d98586

Branch: refs/heads/3.0.x-fixes
Commit: 63d985869d54ab488cf80ffe62b73e126a414752
Parents: 1591faf
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Aug 6 23:46:10 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Aug 6 23:47:01 2015 +0100

----------------------------------------------------------------------
 .../jose/jwe/AbstractJweDecryption.java         |  8 ++--
 .../jose/jwe/AesCbcHmacJweDecryption.java       |  6 +--
 .../jwe/AesGcmContentDecryptionAlgorithm.java   |  2 +-
 .../jose/jwe/ContentDecryptionAlgorithm.java    | 24 ----------
 .../jose/jwe/ContentDecryptionProvider.java     | 24 ++++++++++
 .../jose/jwe/DirectKeyDecryptionAlgorithm.java  |  2 +-
 .../jose/jwe/DirectKeyJweDecryption.java        |  4 +-
 .../jwe/EcdhAesWrapKeyDecryptionAlgorithm.java  |  4 +-
 .../cxf/rs/security/jose/jwe/JweDecryption.java |  4 +-
 .../cxf/rs/security/jose/jwe/JweUtils.java      | 50 ++++++++++----------
 .../jose/jwe/KeyDecryptionAlgorithm.java        | 27 -----------
 .../jose/jwe/KeyDecryptionProvider.java         | 27 +++++++++++
 .../PbesHmacAesWrapKeyDecryptionAlgorithm.java  |  4 +-
 .../jose/jwe/WrappedKeyDecryptionAlgorithm.java |  2 +-
 .../cxf/rs/security/jose/jwk/JwkUtils.java      |  4 +-
 .../jose/jwe/JweCompactReaderWriterTest.java    |  2 +-
 16 files changed, 97 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
index f1bb990..4be6c48 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
@@ -34,10 +34,10 @@ import org.apache.cxf.rt.security.crypto.KeyProperties;
 public abstract class AbstractJweDecryption implements JweDecryptionProvider {
     protected static final Logger LOG = LogUtils.getL7dLogger(JwsUtils.class);
     
-    private KeyDecryptionAlgorithm keyDecryptionAlgo;
-    private ContentDecryptionAlgorithm contentDecryptionAlgo;
-    protected AbstractJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo,
-                                    ContentDecryptionAlgorithm contentDecryptionAlgo) {
+    private KeyDecryptionProvider keyDecryptionAlgo;
+    private ContentDecryptionProvider contentDecryptionAlgo;
+    protected AbstractJweDecryption(KeyDecryptionProvider keyDecryptionAlgo,
+                                    ContentDecryptionProvider contentDecryptionAlgo) {
         this.keyDecryptionAlgo = keyDecryptionAlgo;
         this.contentDecryptionAlgo = contentDecryptionAlgo;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
index c89ffd1..e713ff0 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
@@ -28,10 +28,10 @@ import org.apache.cxf.rs.security.jose.jwa.ContentAlgorithm;
 
 public class AesCbcHmacJweDecryption extends JweDecryption {
     private String supportedAlgo;
-    public AesCbcHmacJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo) {
+    public AesCbcHmacJweDecryption(KeyDecryptionProvider keyDecryptionAlgo) {
         this(keyDecryptionAlgo, null);
     }
-    public AesCbcHmacJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo,
+    public AesCbcHmacJweDecryption(KeyDecryptionProvider keyDecryptionAlgo,
                                    ContentAlgorithm supportedAlgo) {
         super(keyDecryptionAlgo, new AesCbcContentDecryptionAlgorithm(supportedAlgo));
         this.supportedAlgo = supportedAlgo == null ? null : supportedAlgo.getJwaName();
@@ -63,7 +63,7 @@ public class AesCbcHmacJweDecryption extends JweDecryption {
         
     }
     private static class AesCbcContentDecryptionAlgorithm extends AbstractContentEncryptionCipherProperties
-        implements ContentDecryptionAlgorithm {
+        implements ContentDecryptionProvider {
         public AesCbcContentDecryptionAlgorithm(ContentAlgorithm supportedAlgo) {
             super(supportedAlgo);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentDecryptionAlgorithm.java
index 9e95f00..64206b7 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentDecryptionAlgorithm.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentDecryptionAlgorithm.java
@@ -24,7 +24,7 @@ import org.apache.cxf.rs.security.jose.jwa.ContentAlgorithm;
 
 
 public class AesGcmContentDecryptionAlgorithm extends AbstractContentEncryptionCipherProperties
-    implements ContentDecryptionAlgorithm {
+    implements ContentDecryptionProvider {
     public AesGcmContentDecryptionAlgorithm(ContentAlgorithm supportedAlgo) {
         super(supportedAlgo);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionAlgorithm.java
deleted file mode 100644
index ccf7ce7..0000000
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionAlgorithm.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.rs.security.jose.jwe;
-
-
-public interface ContentDecryptionAlgorithm extends ContentEncryptionCipherProperties {
-    byte[] getEncryptedSequence(JweHeaders headers, byte[] cipher, byte[] authTag);
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionProvider.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionProvider.java
new file mode 100644
index 0000000..6c79019
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/ContentDecryptionProvider.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jwe;
+
+
+public interface ContentDecryptionProvider extends ContentEncryptionCipherProperties {
+    byte[] getEncryptedSequence(JweHeaders headers, byte[] cipher, byte[] authTag);
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
index 3f19e6a..3883dcd 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
@@ -25,7 +25,7 @@ import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.rs.security.jose.jwa.KeyAlgorithm;
 import org.apache.cxf.rt.security.crypto.CryptoUtils;
 
-public class DirectKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm {
+public class DirectKeyDecryptionAlgorithm implements KeyDecryptionProvider {
     private static final Logger LOG = LogUtils.getL7dLogger(DirectKeyDecryptionAlgorithm.class);
     private byte[] contentDecryptionKey;
     public DirectKeyDecryptionAlgorithm(Key contentDecryptionKey) {    

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
index afc6d8a..7434acf 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
@@ -21,11 +21,11 @@ package org.apache.cxf.rs.security.jose.jwe;
 
 
 public class DirectKeyJweDecryption extends JweDecryption {
-    public DirectKeyJweDecryption(String encodedKey, ContentDecryptionAlgorithm ctAlgo) {
+    public DirectKeyJweDecryption(String encodedKey, ContentDecryptionProvider ctAlgo) {
         super(new DirectKeyDecryptionAlgorithm(encodedKey), 
               ctAlgo);
     }
-    public DirectKeyJweDecryption(byte[] key, ContentDecryptionAlgorithm ctAlgo) {
+    public DirectKeyJweDecryption(byte[] key, ContentDecryptionProvider ctAlgo) {
         super(new DirectKeyDecryptionAlgorithm(key), 
               ctAlgo);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhAesWrapKeyDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhAesWrapKeyDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhAesWrapKeyDecryptionAlgorithm.java
index 1d9741e..4860904 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhAesWrapKeyDecryptionAlgorithm.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhAesWrapKeyDecryptionAlgorithm.java
@@ -23,7 +23,7 @@ import java.security.interfaces.ECPrivateKey;
 import org.apache.cxf.rs.security.jose.jwa.AlgorithmUtils;
 import org.apache.cxf.rs.security.jose.jwa.KeyAlgorithm;
 
-public class EcdhAesWrapKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm {
+public class EcdhAesWrapKeyDecryptionAlgorithm implements KeyDecryptionProvider {
     private ECPrivateKey key;
     private KeyAlgorithm algo;
     public EcdhAesWrapKeyDecryptionAlgorithm(ECPrivateKey key) {    
@@ -38,7 +38,7 @@ public class EcdhAesWrapKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm
         byte[] derivedKey = 
             EcdhDirectKeyJweDecryption.getDecryptedContentEncryptionKeyFromHeaders(
                 jweDecryptionInput.getJweHeaders(), key);
-        KeyDecryptionAlgorithm aesWrap = new AesWrapKeyDecryptionAlgorithm(derivedKey) {
+        KeyDecryptionProvider aesWrap = new AesWrapKeyDecryptionAlgorithm(derivedKey) {
             protected boolean isValidAlgorithmFamily(String wrapAlgo) {
                 return AlgorithmUtils.isEcdhEsWrap(wrapAlgo);
             }    

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java
index 9642354..4b5b4bf 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java
@@ -21,8 +21,8 @@ package org.apache.cxf.rs.security.jose.jwe;
 
 public class JweDecryption extends AbstractJweDecryption {
     
-    public JweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo,
-                                   ContentDecryptionAlgorithm cipherProps) {    
+    public JweDecryption(KeyDecryptionProvider keyDecryptionAlgo,
+                         ContentDecryptionProvider cipherProps) {    
         super(keyDecryptionAlgo, cipherProps);
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
index 5c79dbf..735f0c0 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
@@ -104,19 +104,19 @@ public final class JweUtils {
         return jwe.encrypt(content, toJweHeaders(ct));
     }
     public static byte[] decrypt(PrivateKey key, KeyAlgorithm keyAlgo, ContentAlgorithm contentAlgo,
String content) {
-        KeyDecryptionAlgorithm keyDecryptionProvider = getPrivateKeyDecryptionAlgorithm(key,
keyAlgo);
+        KeyDecryptionProvider keyDecryptionProvider = getPrivateKeyDecryptionProvider(key,
keyAlgo);
         return decrypt(keyDecryptionProvider, contentAlgo, content);
     }
     public static byte[] decrypt(SecretKey key, KeyAlgorithm keyAlgo, ContentAlgorithm contentAlgo,
String content) {
         if (keyAlgo != null) {
-            KeyDecryptionAlgorithm keyDecryptionProvider = getSecretKeyDecryptionAlgorithm(key,
keyAlgo);
+            KeyDecryptionProvider keyDecryptionProvider = getSecretKeyDecryptionProvider(key,
keyAlgo);
             return decrypt(keyDecryptionProvider, contentAlgo, content);
         } else {
             return decryptDirect(key, contentAlgo, content);
         }
     }
     public static byte[] decrypt(JsonWebKey key, ContentAlgorithm contentAlgo, String content)
{
-        KeyDecryptionAlgorithm keyDecryptionProvider = getKeyDecryptionAlgorithm(key);
+        KeyDecryptionProvider keyDecryptionProvider = getKeyDecryptionProvider(key);
         return decrypt(keyDecryptionProvider, contentAlgo, content);
     }
     public static byte[] decryptDirect(SecretKey key, ContentAlgorithm contentAlgo, String
content) {
@@ -159,35 +159,35 @@ public final class JweUtils {
         }
         return null;
     }
-    public static KeyDecryptionAlgorithm getKeyDecryptionAlgorithm(JsonWebKey jwk) {
-        return getKeyDecryptionAlgorithm(jwk, null);
+    public static KeyDecryptionProvider getKeyDecryptionProvider(JsonWebKey jwk) {
+        return getKeyDecryptionProvider(jwk, null);
     }
     
-    public static KeyDecryptionAlgorithm getKeyDecryptionAlgorithm(JsonWebKey jwk, KeyAlgorithm
defaultAlgorithm) {
+    public static KeyDecryptionProvider getKeyDecryptionProvider(JsonWebKey jwk, KeyAlgorithm
defaultAlgorithm) {
         KeyAlgorithm keyAlgo = jwk.getAlgorithm() == null ? defaultAlgorithm 
             : KeyAlgorithm.getAlgorithm(jwk.getAlgorithm());
-        KeyDecryptionAlgorithm keyDecryptionProvider = null;
+        KeyDecryptionProvider keyDecryptionProvider = null;
         KeyType keyType = jwk.getKeyType();
         if (KeyType.RSA == keyType) {
-            keyDecryptionProvider = getPrivateKeyDecryptionAlgorithm(JwkUtils.toRSAPrivateKey(jwk),

+            keyDecryptionProvider = getPrivateKeyDecryptionProvider(JwkUtils.toRSAPrivateKey(jwk),

                                                                  keyAlgo);
         } else if (KeyType.OCTET == keyType) {
-            keyDecryptionProvider = getSecretKeyDecryptionAlgorithm(JwkUtils.toSecretKey(jwk),
+            keyDecryptionProvider = getSecretKeyDecryptionProvider(JwkUtils.toSecretKey(jwk),
                                             keyAlgo);
         } else {
-            keyDecryptionProvider = getPrivateKeyDecryptionAlgorithm(JwkUtils.toECPrivateKey(jwk),

+            keyDecryptionProvider = getPrivateKeyDecryptionProvider(JwkUtils.toECPrivateKey(jwk),

                                                                      keyAlgo);
         }
         return keyDecryptionProvider;
     }
-    public static KeyDecryptionAlgorithm getPrivateKeyDecryptionAlgorithm(PrivateKey key,
KeyAlgorithm algo) {
+    public static KeyDecryptionProvider getPrivateKeyDecryptionProvider(PrivateKey key, KeyAlgorithm
algo) {
         if (key instanceof RSAPrivateKey) {
             return new RSAKeyDecryptionAlgorithm((RSAPrivateKey)key, algo);
         } else {
             return new EcdhAesWrapKeyDecryptionAlgorithm((ECPrivateKey)key, algo);
         }
     }
-    public static KeyDecryptionAlgorithm getSecretKeyDecryptionAlgorithm(SecretKey key, KeyAlgorithm
algo) {
+    public static KeyDecryptionProvider getSecretKeyDecryptionProvider(SecretKey key, KeyAlgorithm
algo) {
         if (AlgorithmUtils.isAesKeyWrap(algo.getJwaName())) {
             return new AesWrapKeyDecryptionAlgorithm(key, algo);
         } else if (AlgorithmUtils.isAesGcmKeyWrap(algo.getJwaName())) {
@@ -221,7 +221,7 @@ public final class JweUtils {
         }
         return null;
     }
-    public static ContentDecryptionAlgorithm getContentDecryptionAlgorithm(ContentAlgorithm
algorithm) {
+    public static ContentDecryptionProvider getContentDecryptionProvider(ContentAlgorithm
algorithm) {
         if (AlgorithmUtils.isAesGcm(algorithm.getJwaName())) {
             return new AesGcmContentDecryptionAlgorithm(algorithm);
         }
@@ -262,7 +262,7 @@ public final class JweUtils {
             return new AesCbcHmacJweDecryption(new DirectKeyDecryptionAlgorithm(key), algorithm);
         } else {
             return new JweDecryption(new DirectKeyDecryptionAlgorithm(key), 
-                                 getContentDecryptionAlgorithm(algorithm));
+                                 getContentDecryptionProvider(algorithm));
         }
     }
     public static JweEncryptionProvider loadEncryptionProvider(boolean required) {
@@ -329,7 +329,7 @@ public final class JweUtils {
             return null;
         }    
         
-        KeyDecryptionAlgorithm keyDecryptionProvider = null;
+        KeyDecryptionProvider keyDecryptionProvider = null;
         String contentEncryptionAlgo = getContentEncryptionAlgo(m, props, null);
         SecretKey ctDecryptionKey = null;
         String keyEncryptionAlgo = getKeyEncryptionAlgo(m, props, null, null);
@@ -342,7 +342,7 @@ public final class JweUtils {
             PrivateKey privateKey = 
                 KeyManagementUtils.loadPrivateKey(m, props, chain, KeyOperation.DECRYPT);
             contentEncryptionAlgo = inHeaders.getContentEncryptionAlgorithm().getJwaName();
-            keyDecryptionProvider = getPrivateKeyDecryptionAlgorithm(privateKey, 
+            keyDecryptionProvider = getPrivateKeyDecryptionProvider(privateKey, 
                                                                  inHeaders.getKeyEncryptionAlgorithm());
         } else {
             if (JwkUtils.JWK_KEY_STORE_TYPE.equals(props.get(KeyManagementUtils.RSSEC_KEY_STORE_TYPE)))
{
@@ -353,11 +353,11 @@ public final class JweUtils {
                 } else {
                     keyEncryptionAlgo = getKeyEncryptionAlgo(m, props, jwk.getAlgorithm(),
                                                              getDefaultKeyAlgo(jwk));
-                    keyDecryptionProvider = getKeyDecryptionAlgorithm(jwk, 
+                    keyDecryptionProvider = getKeyDecryptionProvider(jwk, 
                                                                       KeyAlgorithm.getAlgorithm(keyEncryptionAlgo));
                 }
             } else {
-                keyDecryptionProvider = getPrivateKeyDecryptionAlgorithm(
+                keyDecryptionProvider = getPrivateKeyDecryptionProvider(
                     KeyManagementUtils.loadPrivateKey(m, props, KeyOperation.DECRYPT), 
                     KeyAlgorithm.getAlgorithm(keyEncryptionAlgo));
             }
@@ -420,24 +420,24 @@ public final class JweUtils {
     public static JweDecryptionProvider createJweDecryptionProvider(PrivateKey key,
                                                                     KeyAlgorithm keyAlgo,
                                                                     ContentAlgorithm contentDecryptionAlgo)
{
-        return createJweDecryptionProvider(getPrivateKeyDecryptionAlgorithm(key, keyAlgo),
contentDecryptionAlgo);
+        return createJweDecryptionProvider(getPrivateKeyDecryptionProvider(key, keyAlgo),
contentDecryptionAlgo);
     }
     public static JweDecryptionProvider createJweDecryptionProvider(SecretKey key,
                                                                     KeyAlgorithm keyAlgo,
                                                                     ContentAlgorithm contentDecryptionAlgo)
{
-        return createJweDecryptionProvider(getSecretKeyDecryptionAlgorithm(key, keyAlgo),
contentDecryptionAlgo);
+        return createJweDecryptionProvider(getSecretKeyDecryptionProvider(key, keyAlgo),
contentDecryptionAlgo);
     }
     public static JweDecryptionProvider createJweDecryptionProvider(JsonWebKey key,
                                                                     ContentAlgorithm contentDecryptionAlgo)
{
-        return createJweDecryptionProvider(getKeyDecryptionAlgorithm(key), contentDecryptionAlgo);
+        return createJweDecryptionProvider(getKeyDecryptionProvider(key), contentDecryptionAlgo);
     }
-    public static JweDecryptionProvider createJweDecryptionProvider(KeyDecryptionAlgorithm
keyDecryptionProvider,
+    public static JweDecryptionProvider createJweDecryptionProvider(KeyDecryptionProvider
keyDecryptionProvider,
                                                                     ContentAlgorithm contentDecryptionAlgo)
{
         if (AlgorithmUtils.isAesCbcHmac(contentDecryptionAlgo.getJwaName())) { 
             return new AesCbcHmacJweDecryption(keyDecryptionProvider, contentDecryptionAlgo);
         } else {
             return new JweDecryption(keyDecryptionProvider, 
-                                     getContentDecryptionAlgorithm(contentDecryptionAlgo));
+                                     getContentDecryptionProvider(contentDecryptionAlgo));
         }
     }
     public static boolean validateCriticalHeaders(JoseHeaders headers) {
@@ -566,7 +566,7 @@ public final class JweUtils {
             return new JweEncryption(new DirectKeyEncryptionAlgorithm(), ctEncryptionProvider);
         }
     }
-    private static JweDecryptionProvider createJweDecryptionProvider(KeyDecryptionAlgorithm
keyDecryptionProvider,
+    private static JweDecryptionProvider createJweDecryptionProvider(KeyDecryptionProvider
keyDecryptionProvider,
                                                                     SecretKey ctDecryptionKey,
                                                                     ContentAlgorithm contentDecryptionAlgo)
{
         if (keyDecryptionProvider == null && ctDecryptionKey == null) {
@@ -610,7 +610,7 @@ public final class JweUtils {
         JweEncryptionProvider jwe = createJweEncryptionProvider(keyEncryptionProvider, contentAlgo,
null);
         return jwe.encrypt(content, toJweHeaders(ct));
     }
-    private static byte[] decrypt(KeyDecryptionAlgorithm keyDecryptionProvider, ContentAlgorithm
contentAlgo, 
+    private static byte[] decrypt(KeyDecryptionProvider keyDecryptionProvider, ContentAlgorithm
contentAlgo, 
                                   String content) {
         JweDecryptionProvider jwe = createJweDecryptionProvider(keyDecryptionProvider, contentAlgo);
         return jwe.decrypt(content).getContent();

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionAlgorithm.java
deleted file mode 100644
index bccd896..0000000
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionAlgorithm.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.rs.security.jose.jwe;
-
-import org.apache.cxf.rs.security.jose.jwa.KeyAlgorithm;
-
-
-public interface KeyDecryptionAlgorithm {
-    KeyAlgorithm getAlgorithm();
-    byte[] getDecryptedContentEncryptionKey(JweDecryptionInput jweDecryptionInput);
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionProvider.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionProvider.java
new file mode 100644
index 0000000..1924e78
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/KeyDecryptionProvider.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jwe;
+
+import org.apache.cxf.rs.security.jose.jwa.KeyAlgorithm;
+
+
+public interface KeyDecryptionProvider {
+    KeyAlgorithm getAlgorithm();
+    byte[] getDecryptedContentEncryptionKey(JweDecryptionInput jweDecryptionInput);
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/PbesHmacAesWrapKeyDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/PbesHmacAesWrapKeyDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/PbesHmacAesWrapKeyDecryptionAlgorithm.java
index 9770ae9..1ee6eea 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/PbesHmacAesWrapKeyDecryptionAlgorithm.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/PbesHmacAesWrapKeyDecryptionAlgorithm.java
@@ -23,7 +23,7 @@ import org.apache.cxf.rs.security.jose.JoseException;
 import org.apache.cxf.rs.security.jose.jwa.AlgorithmUtils;
 import org.apache.cxf.rs.security.jose.jwa.KeyAlgorithm;
 
-public class PbesHmacAesWrapKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm {
+public class PbesHmacAesWrapKeyDecryptionAlgorithm implements KeyDecryptionProvider {
     private byte[] password;
     private KeyAlgorithm algo;
     public PbesHmacAesWrapKeyDecryptionAlgorithm(String password) {    
@@ -55,7 +55,7 @@ public class PbesHmacAesWrapKeyDecryptionAlgorithm implements KeyDecryptionAlgor
         int keySize = PbesHmacAesWrapKeyEncryptionAlgorithm.getKeySize(keyAlgoJwt);
         byte[] derivedKey = PbesHmacAesWrapKeyEncryptionAlgorithm
             .createDerivedKey(keyAlgoJwt, keySize, password, saltInput, pbesCount);
-        KeyDecryptionAlgorithm aesWrap = new AesWrapKeyDecryptionAlgorithm(derivedKey, algo)
{
+        KeyDecryptionProvider aesWrap = new AesWrapKeyDecryptionAlgorithm(derivedKey, algo)
{
             protected boolean isValidAlgorithmFamily(String wrapAlgo) {
                 return AlgorithmUtils.isPbesHsWrap(wrapAlgo);
             }    

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyDecryptionAlgorithm.java
index e7ee28e..0787886 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyDecryptionAlgorithm.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyDecryptionAlgorithm.java
@@ -28,7 +28,7 @@ import org.apache.cxf.rs.security.jose.jwa.KeyAlgorithm;
 import org.apache.cxf.rt.security.crypto.CryptoUtils;
 import org.apache.cxf.rt.security.crypto.KeyProperties;
 
-public class WrappedKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm {
+public class WrappedKeyDecryptionAlgorithm implements KeyDecryptionProvider {
     protected static final Logger LOG = LogUtils.getL7dLogger(WrappedKeyDecryptionAlgorithm.class);
     private Key cekDecryptionKey;
     private boolean unwrap;

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
index f996178..9251c54 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
@@ -62,7 +62,7 @@ import org.apache.cxf.rs.security.jose.jwe.JweDecryptionProvider;
 import org.apache.cxf.rs.security.jose.jwe.JweEncryptionProvider;
 import org.apache.cxf.rs.security.jose.jwe.JweHeaders;
 import org.apache.cxf.rs.security.jose.jwe.JweUtils;
-import org.apache.cxf.rs.security.jose.jwe.KeyDecryptionAlgorithm;
+import org.apache.cxf.rs.security.jose.jwe.KeyDecryptionProvider;
 import org.apache.cxf.rs.security.jose.jwe.KeyEncryptionProvider;
 import org.apache.cxf.rs.security.jose.jwe.PbesHmacAesWrapKeyDecryptionAlgorithm;
 import org.apache.cxf.rs.security.jose.jwe.PbesHmacAesWrapKeyEncryptionAlgorithm;
@@ -486,7 +486,7 @@ public final class JwkUtils {
         return new AesCbcHmacJweEncryption(ContentAlgorithm.A128CBC_HS256, keyEncryption);
     }
     private static JweDecryptionProvider createDefaultDecryption(char[] password) {
-        KeyDecryptionAlgorithm keyDecryption = new PbesHmacAesWrapKeyDecryptionAlgorithm(password);
+        KeyDecryptionProvider keyDecryption = new PbesHmacAesWrapKeyDecryptionAlgorithm(password);
         return new AesCbcHmacJweDecryption(keyDecryption);
     }
     private static JsonWebKey prepareRSAJwk(BigInteger modulus, String algo) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/63d98586/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
index 6a10ea1..8f8c147 100644
--- a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
+++ b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
@@ -170,7 +170,7 @@ public class JweCompactReaderWriterTest extends Assert {
         
         RSAPrivateKey privateKey = CryptoUtils.getRSAPrivateKey(RSA_MODULUS_ENCODED_A1, 
                                                                 RSA_PRIVATE_EXPONENT_ENCODED_A1);
-        KeyDecryptionAlgorithm keyDecryption = new RSAKeyDecryptionAlgorithm(privateKey,
+        KeyDecryptionProvider keyDecryption = new RSAKeyDecryptionAlgorithm(privateKey,
                                                                              KeyAlgorithm.RSA1_5);
         JweDecryptionProvider decryption = new AesCbcHmacJweDecryption(keyDecryption);
         String decryptedText = decryption.decrypt(jweContent).getContentText();


Mime
View raw message