ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1603456 - /webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/WSSConfig.java
Date Wed, 18 Jun 2014 14:08:15 GMT
Author: coheigea
Date: Wed Jun 18 14:08:14 2014
New Revision: 1603456

URL: http://svn.apache.org/r1603456
Log:
Get WSS4J working with the latest Santuario SNAPSHOT


Conflicts:
	ws-security-common/src/main/java/org/apache/wss4j/common/crypto/WSProviderConfig.java

Modified:
    webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/WSSConfig.java

Modified: webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/WSSConfig.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/WSSConfig.java?rev=1603456&r1=1603455&r2=1603456&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/WSSConfig.java
(original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/WSSConfig.java
Wed Jun 18 14:08:14 2014
@@ -417,6 +417,24 @@ public class WSSConfig {
             }
         }
     }
+
+    private static void useIvParameterSpec() {
+        try {
+            // Don't override if it was set explicitly
+            AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+                public Boolean run() {
+                    String ivParameterSpec = "org.apache.xml.security.cipher.gcm.useIvParameterSpec";
+                    if (System.getProperty(ivParameterSpec) == null) {
+                        System.setProperty(ivParameterSpec, "true");
+                        return false;
+                    }
+                    return true; 
+                }
+            });
+        } catch (Throwable t) { //NOPMD
+            //ignore
+        }
+    }
     
     public static synchronized void init() {
         if (!staticallyInitialized) {
@@ -425,7 +443,16 @@ public class WSSConfig {
                 AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
                     public Boolean run() {
                         addXMLDSigRI();
-                        addJceProvider("BC", "org.bouncycastle.jce.provider.BouncyCastleProvider");
+                        String bcProviderStr = 
+                            addJceProvider("BC", "org.bouncycastle.jce.provider.BouncyCastleProvider");
+                        // If we have BouncyCastle v1.49 installed then use IvParameterSpec
in
+                        // Santuario. This can be removed when we pick up BouncyCastle 1.51+
+                        if (bcProviderStr != null) {
+                            Provider bcProvider = Security.getProvider(bcProviderStr);
+                            if (bcProvider.getInfo().contains("v1.49")) {
+                                useIvParameterSpec();
+                            }
+                        }
                         Security.removeProvider("STRTransform");
                         appendJceProvider(
                             "STRTransform", new org.apache.ws.security.transform.STRTransformProvider()



Mime
View raw message