[jboss-cvs] JBossAS SVN: r103941 - projects/security/security-jboss-sx/branches/2.0.4.SP3_JBPAPP-4086/jbosssx/src/main/java/org/jboss/crypto.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 13 16:59:00 EDT 2010


Author: mmoyses
Date: 2010-04-13 16:58:59 -0400 (Tue, 13 Apr 2010)
New Revision: 103941

Modified:
   projects/security/security-jboss-sx/branches/2.0.4.SP3_JBPAPP-4086/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java
Log:
JBPAPP-4086: backporting SECURITY-498

Modified: projects/security/security-jboss-sx/branches/2.0.4.SP3_JBPAPP-4086/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java
===================================================================
--- projects/security/security-jboss-sx/branches/2.0.4.SP3_JBPAPP-4086/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java	2010-04-13 20:55:24 UTC (rev 103940)
+++ projects/security/security-jboss-sx/branches/2.0.4.SP3_JBPAPP-4086/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java	2010-04-13 20:58:59 UTC (rev 103941)
@@ -35,6 +35,9 @@
 import java.security.Security;
 import java.util.Random;
 
+import javax.crypto.KeyGenerator;
+import javax.crypto.spec.SecretKeySpec;
+
 import org.jboss.crypto.digest.DigestCallback;
 import org.jboss.logging.Logger;
 import org.jboss.security.Base64Encoder;
@@ -472,9 +475,8 @@
    {
       boolean hasUnlimitedCrypto = false;
       try
-      {
-         ClassLoader loader = Thread.currentThread().getContextClassLoader();
-         Class<?> keyGenClass = loader.loadClass("javax.crypto.KeyGenerator");
+      { 
+         Class<?> keyGenClass = KeyGenerator.class;
          Class<?>[] sig = {String.class};
          Object[] args = {"Blowfish"};
          Method kgenInstance = keyGenClass.getDeclaredMethod("getInstance", sig);
@@ -504,9 +506,8 @@
       Object[] args = {key, cipherAlgorithm};
       Object secretKey = null;
       try
-      {
-          ClassLoader loader = Thread.currentThread().getContextClassLoader();
-          Class<?> secretKeySpecClass = loader.loadClass("javax.crypto.spec.SecretKeySpec");
+      { 
+          Class<?> secretKeySpecClass = SecretKeySpec.class;  
           Constructor<?> ctor = secretKeySpecClass.getDeclaredConstructor(signature);
           secretKey = ctor.newInstance(args);
       }




More information about the jboss-cvs-commits mailing list