Author: coheigea
Date: Thu Jan 12 16:41:39 2012
New Revision: 1230629

URL: http://svn.apache.org/viewvc?rev=1230629&view=rev
Log:
A fix for a Santuario 1.5.0-SNAPSHOT update

Modified:
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/WSSecurityUtil.java

Modified: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/WSSecurityUtil.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/WSSecurityUtil.java?rev=1230629&r1=1230628&r2=1230629&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/WSSecurityUtil.java
 (original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/WSSecurityUtil.java
 Thu Jan 12 16:41:39 2012
@@ -801,10 +801,23 @@ public class WSSecurityUtil {
                 new Object[] { "No such padding: " + cipherAlgo }, ex
             );
         } catch (NoSuchAlgorithmException ex) {
-            throw new WSSecurityException(
-                WSSecurityException.UNSUPPORTED_ALGORITHM, 
"unsupportedKeyTransp",
-                new Object[] { "No such algorithm: " + cipherAlgo }, ex
-            );
+            // Check to see if an RSA OAEP MGF-1 with SHA-1 algorithm was 
requested
+            // Some JDKs don't support RSA/ECB/OAEPPadding
+            if (WSConstants.KEYTRANSPORT_RSAOEP.equals(cipherAlgo)) {
+                try {
+                    return 
Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
+                } catch (Exception e) {
+                    throw new WSSecurityException(
+                        WSSecurityException.UNSUPPORTED_ALGORITHM, 
"unsupportedKeyTransp",
+                        new Object[] { "No such algorithm: " + cipherAlgo }, e
+                    );
+                }
+            } else {
+                throw new WSSecurityException(
+                    WSSecurityException.UNSUPPORTED_ALGORITHM, 
"unsupportedKeyTransp",
+                    new Object[] { "No such algorithm: " + cipherAlgo }, ex
+                );
+            }
         }
     }
     


Reply via email to