cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: using Java 7 classes directly
Date Tue, 12 Aug 2014 10:37:38 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 49791d37e -> ff742436a


using Java 7 classes directly


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

Branch: refs/heads/master
Commit: ff742436a3e177dc61106edf08f2509e727362dd
Parents: 49791d3
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Aug 12 11:37:20 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Aug 12 11:37:20 2014 +0100

----------------------------------------------------------------------
 .../rs/security/oauth2/utils/crypto/CryptoUtils.java   | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ff742436/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
index ebbb3fd..6b8c777 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
@@ -20,7 +20,6 @@
 package org.apache.cxf.rs.security.oauth2.utils.crypto;
 
 import java.io.InputStream;
-import java.lang.reflect.Constructor;
 import java.math.BigInteger;
 import java.security.Key;
 import java.security.KeyFactory;
@@ -49,11 +48,11 @@ import java.util.Properties;
 import javax.crypto.Cipher;
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
+import javax.crypto.spec.GCMParameterSpec;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.util.CompressionUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
@@ -337,7 +336,6 @@ public final class CryptoUtils {
         }    
     }
     public static AlgorithmParameterSpec getContentEncryptionCipherSpec(int authTagLength,
byte[] iv) {
-        // this can be overridden if needed
         if (authTagLength > 0) {
             return CryptoUtils.getGCMParameterSpec(authTagLength, iv);
         } else if (iv.length > 0) {
@@ -348,14 +346,7 @@ public final class CryptoUtils {
     }
     
     public static AlgorithmParameterSpec getGCMParameterSpec(int authTagLength, byte[] iv)
{
-        try {
-            // In case Java 6 compiler is used
-            Class<?> c = ClassLoaderUtils.loadClass("javax.crypto.spec.GCMParameterSpec",
CryptoUtils.class);
-            Constructor<?> ctr = c.getConstructor(new Class[]{int.class, byte[].class});
-            return (AlgorithmParameterSpec)ctr.newInstance(new Object[]{authTagLength, iv});
-        } catch (Throwable t) {
-            return new IvParameterSpec(iv);
-        }
+        return new GCMParameterSpec(authTagLength, iv);
     }
     
     public static byte[] signData(byte[] data, PrivateKey key, String signAlgo) {


Mime
View raw message