camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1136433 - /camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
Date Thu, 16 Jun 2011 13:38:10 GMT
Author: hadrian
Date: Thu Jun 16 13:38:10 2011
New Revision: 1136433

URL: http://svn.apache.org/viewvc?rev=1136433&view=rev
Log:
CAMEL-4061. Use lower key strenght if AES optional pack is not present

Modified:
    camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java

Modified: camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java?rev=1136433&r1=1136432&r2=1136433&view=diff
==============================================================================
--- camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
(original)
+++ camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
Thu Jun 16 13:38:10 2011
@@ -35,7 +35,6 @@ import org.apache.camel.component.mock.M
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.xml.security.encryption.XMLCipher;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -57,6 +56,9 @@ public class XMLSecurityDataFormatTest e
         + "<cheese>brie</cheese>"
         + "</france>"
         + "</cheesesites>";
+    
+    // one could use testCypherAlgorithm = XMLCipher.AES_128 if she had the AES Optional
Pack installed
+    private String testCypherAlgorithm = XMLCipher.AES_128;
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -207,7 +209,6 @@ public class XMLSecurityDataFormatTest e
         testEncryption();
     }
 
-    @Ignore
     @Test
     public void testFullPayloadAsymmetricKeyEncryption() throws Exception {
         KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -216,7 +217,7 @@ public class XMLSecurityDataFormatTest e
 
         final XMLSecurityDataFormat xmlEncDataFormat = new XMLSecurityDataFormat();
         xmlEncDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_v1dot5);
-        xmlEncDataFormat.setXmlCipherAlgorithm(XMLCipher.AES_256);
+        xmlEncDataFormat.setXmlCipherAlgorithm(testCypherAlgorithm);
         xmlEncDataFormat.setTrustStore(trustStore);
         xmlEncDataFormat.setTrustStorePassword("password");
         xmlEncDataFormat.setRecipientKeyAlias("recipient");
@@ -230,7 +231,6 @@ public class XMLSecurityDataFormatTest e
         testEncryption();
     }
 
-    @Ignore
     @Test
     public void testPartialPayloadAsymmetricKeyEncryptionWithContextTruststoreProperties()
throws Exception {
         Map<String, String> contextProps = context.getProperties();
@@ -241,14 +241,13 @@ public class XMLSecurityDataFormatTest e
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                    .marshal().secureXML("//cheesesites/italy/cheese", true, "recipient",
XMLCipher.AES_256, XMLCipher.RSA_v1dot5)
+                    .marshal().secureXML("//cheesesites/italy/cheese", true, "recipient",
testCypherAlgorithm, XMLCipher.RSA_v1dot5)
                     .to("mock:encrypted");
             }
         });
         testEncryption();
     }
  
-    @Ignore
     @Test
     public void testPartialPayloadAsymmetricKeyEncryptionWithExchangeRecipientAlias() throws
Exception {
         MockEndpoint resultEndpoint = context.getEndpoint("mock:foo", MockEndpoint.class);
@@ -267,7 +266,7 @@ public class XMLSecurityDataFormatTest e
                             exchange.getIn().setHeader(XMLSecurityDataFormat.XML_ENC_RECIPIENT_ALIAS,
"recipient");
                         }
                     })
-                    .marshal().secureXML("//cheesesites/italy/cheese", true, null, XMLCipher.AES_256,
XMLCipher.RSA_v1dot5)
+                    .marshal().secureXML("//cheesesites/italy/cheese", true, null, testCypherAlgorithm,
XMLCipher.RSA_v1dot5)
                     .to("mock:encrypted");
             }
         });
@@ -343,7 +342,6 @@ public class XMLSecurityDataFormatTest e
         testDecryption();
     }
 
-    @Ignore
     @Test
     public void testFullPayloadAsymmetricKeyDecryption() throws Exception {
 
@@ -361,14 +359,13 @@ public class XMLSecurityDataFormatTest e
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                    .marshal().secureXML("", true, null, XMLCipher.AES_256, XMLCipher.RSA_v1dot5).to("mock:encrypted")
-                    .unmarshal().secureXML("", true, null, XMLCipher.AES_256, XMLCipher.RSA_v1dot5).to("mock:decrypted");
+                    .marshal().secureXML("", true, null, testCypherAlgorithm, XMLCipher.RSA_v1dot5).to("mock:encrypted")
+                    .unmarshal().secureXML("", true, null, testCypherAlgorithm, XMLCipher.RSA_v1dot5).to("mock:decrypted");
             }
         });
         testDecryption();
     }
 
-    @Ignore
     @Test
     public void testPartialPayloadAsymmetricKeyDecryption() throws Exception {
 
@@ -387,8 +384,8 @@ public class XMLSecurityDataFormatTest e
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                    .marshal().secureXML("//cheesesites/italy", true, null, XMLCipher.AES_256,
XMLCipher.RSA_v1dot5).to("mock:encrypted")
-                    .unmarshal().secureXML("//cheesesites/italy", true, null, XMLCipher.AES_256,
XMLCipher.RSA_v1dot5).to("mock:decrypted");
+                    .marshal().secureXML("//cheesesites/italy", true, null, testCypherAlgorithm,
XMLCipher.RSA_v1dot5).to("mock:encrypted")
+                    .unmarshal().secureXML("//cheesesites/italy", true, null, testCypherAlgorithm,
XMLCipher.RSA_v1dot5).to("mock:decrypted");
             }
         });
         testDecryption();



Mime
View raw message