You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/02/12 19:57:54 UTC

svn commit: r909557 - /cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java

Author: dkulp
Date: Fri Feb 12 18:57:53 2010
New Revision: 909557

URL: http://svn.apache.org/viewvc?rev=909557&view=rev
Log:
Test failed in hudson, I think due to not having the strong encryption
stuff.

Modified:
    cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java?rev=909557&r1=909556&r2=909557&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java Fri Feb 12 18:57:53 2010
@@ -27,6 +27,9 @@
 import java.util.Vector;
 import java.util.concurrent.Executor;
 
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
 import javax.xml.namespace.QName;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPException;
@@ -72,6 +75,25 @@
 public class PolicyBasedWss4JInOutTest extends AbstractSecurityTest {
     private PolicyBuilder policyBuilder;
        
+    public static boolean checkUnrestrictedPoliciesInstalled() {
+        try {
+            byte[] data = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
+
+            SecretKey key192 = new SecretKeySpec(
+                new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+                            0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+                            0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17},
+                            "AES");
+            Cipher c = Cipher.getInstance("AES");
+            c.init(Cipher.ENCRYPT_MODE, key192);
+            c.doFinal(data);
+            return true;
+        } catch (Exception e) {
+            //ignore
+        }
+        return false;
+    }
+    
     @Test
     @org.junit.Ignore("missing file")
     public void testSignedElementsPolicyWithIncompleteCoverage() throws Exception {
@@ -386,6 +408,9 @@
     
     @Test
     public void testSignedEncryptedPartsWithCompleteCoverage() throws Exception {
+        if (!checkUnrestrictedPoliciesInstalled()) {
+            return;
+        }
         this.runInInterceptorAndValidate(
                 "signed_x509_issuer_serial_encrypted.xml",
                 "signed_parts_policy_header_and_body_encrypted.xml",