ws-wss4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r783849 - /webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java
Date Thu, 11 Jun 2009 17:00:40 GMT
Author: dkulp
Date: Thu Jun 11 17:00:40 2009
New Revision: 783849

URL: http://svn.apache.org/viewvc?rev=783849&view=rev
Log:
Use JCEMapper to map to the approriate JCE Cipher ID

Modified:
    webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java

Modified: webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java?rev=783849&r1=783848&r2=783849&view=diff
==============================================================================
--- webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java
(original)
+++ webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java
Thu Jun 11 17:00:40 2009
@@ -757,17 +757,23 @@
 
     public static Cipher getCipherInstance(String cipherAlgo)
         throws WSSecurityException {
+        
+        String jceid = JCEMapper.translateURItoJCEID(cipherAlgo);
         Cipher cipher = null;
         try {
-            if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSA15)) {
-                cipher = Cipher.getInstance("RSA/NONE/PKCS1PADDING");
-            } else if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSAOEP)) {
-                cipher = Cipher.getInstance("RSA/NONE/OAEPPADDING");
+            if (jceid == null) {
+                if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSA15)) {
+                    cipher = Cipher.getInstance("RSA/NONE/PKCS1PADDING");
+                } else if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSAOEP))
{
+                    cipher = Cipher.getInstance("RSA/NONE/OAEPPADDING");
+                } else {
+                    throw new WSSecurityException(
+                        WSSecurityException.UNSUPPORTED_ALGORITHM,
+                        "unsupportedKeyTransp", new Object[] {cipherAlgo}
+                    );
+                }
             } else {
-                throw new WSSecurityException(
-                    WSSecurityException.UNSUPPORTED_ALGORITHM,
-                    "unsupportedKeyTransp", new Object[] {cipherAlgo}
-                );
+                cipher = Cipher.getInstance(jceid);
             }
         } catch (NoSuchPaddingException ex) {
             throw new WSSecurityException(



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Mime
View raw message