Author: davsclaus
Date: Wed Aug 29 08:36:27 2012
New Revision: 1378476
URL: http://svn.apache.org/viewvc?rev=1378476&view=rev
Log:
CAMEL-5545: Support key password for private key access in XMLSecurity. Thanks
to Rich Newcomb for the patch.
Added:
camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest.java
(with props)
camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
(with props)
camel/trunk/components/camel-xmlsecurity/src/test/resources/recipient-with-key-pass.ks
(with props)
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
camel/trunk/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java?rev=1378476&r1=1378475&r2=1378476&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
Wed Aug 29 08:36:27 2012
@@ -525,6 +525,16 @@ public class DataFormatClause<T extends
* Uses the XML Security data format
*/
public T secureXML(String secureTag, boolean secureTagContents, String
recipientKeyAlias, String xmlCipherAlgorithm,
+ String keyCipherAlgorithm, String keyOrTrustStoreParametersId,
String keyPassword) {
+ XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
secureTagContents, recipientKeyAlias, xmlCipherAlgorithm,
+ keyCipherAlgorithm, keyOrTrustStoreParametersId, keyPassword);
+ return dataFormat(xsdf);
+ }
+
+ /**
+ * Uses the XML Security data format
+ */
+ public T secureXML(String secureTag, boolean secureTagContents, String
recipientKeyAlias, String xmlCipherAlgorithm,
String keyCipherAlgorithm, KeyStoreParameters
keyOrTrustStoreParameters) {
XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
secureTagContents, recipientKeyAlias, xmlCipherAlgorithm,
keyCipherAlgorithm, keyOrTrustStoreParameters);
@@ -534,6 +544,16 @@ public class DataFormatClause<T extends
/**
* Uses the XML Security data format
*/
+ public T secureXML(String secureTag, boolean secureTagContents, String
recipientKeyAlias, String xmlCipherAlgorithm,
+ String keyCipherAlgorithm, KeyStoreParameters
keyOrTrustStoreParameters, String keyPassword) {
+ XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
secureTagContents, recipientKeyAlias, xmlCipherAlgorithm,
+ keyCipherAlgorithm, keyOrTrustStoreParameters, keyPassword);
+ return dataFormat(xsdf);
+ }
+
+ /**
+ * Uses the XML Security data format
+ */
public T secureXML(String secureTag, Map<String, String> namespaces,
boolean secureTagContents, String recipientKeyAlias,
String xmlCipherAlgorithm, String keyCipherAlgorithm, String
keyOrTrustStoreParametersId) {
XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
namespaces, secureTagContents, recipientKeyAlias, xmlCipherAlgorithm,
@@ -545,6 +565,16 @@ public class DataFormatClause<T extends
* Uses the XML Security data format
*/
public T secureXML(String secureTag, Map<String, String> namespaces,
boolean secureTagContents, String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String
keyOrTrustStoreParametersId, String keyPassword) {
+ XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
namespaces, secureTagContents, recipientKeyAlias, xmlCipherAlgorithm,
+ keyCipherAlgorithm, keyOrTrustStoreParametersId, keyPassword);
+ return dataFormat(xsdf);
+ }
+
+ /**
+ * Uses the XML Security data format
+ */
+ public T secureXML(String secureTag, Map<String, String> namespaces,
boolean secureTagContents, String recipientKeyAlias,
String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters) {
XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
namespaces, secureTagContents, recipientKeyAlias, xmlCipherAlgorithm,
keyCipherAlgorithm, keyOrTrustStoreParameters);
@@ -552,6 +582,16 @@ public class DataFormatClause<T extends
}
/**
+ * Uses the XML Security data format
+ */
+ public T secureXML(String secureTag, Map<String, String> namespaces,
boolean secureTagContents, String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters, String keyPassword) {
+ XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
namespaces, secureTagContents, recipientKeyAlias, xmlCipherAlgorithm,
+ keyCipherAlgorithm, keyOrTrustStoreParameters, keyPassword);
+ return dataFormat(xsdf);
+ }
+
+ /**
* Uses the xmlBeans data format
*/
public T xmlBeans() {
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java?rev=1378476&r1=1378475&r2=1378476&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
Wed Aug 29 08:36:27 2012
@@ -53,6 +53,8 @@ public class XMLSecurityDataFormat exten
private String recipientKeyAlias;
@XmlAttribute
private String keyOrTrustStoreParametersId;
+ @XmlAttribute
+ private String keyPassword;
@XmlTransient
private KeyStoreParameters keyOrTrustStoreParameters;
@@ -133,6 +135,26 @@ public class XMLSecurityDataFormat exten
this.setKeyCipherAlgorithm(keyCipherAlgorithm);
this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
}
+
+ public XMLSecurityDataFormat(String secureTag, boolean secureTagContents,
String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String
keyOrTrustStoreParametersId, String keyPassword) {
+ this(secureTag, secureTagContents);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ this.setKeyPassword(keyPassword);
+ }
+
+ public XMLSecurityDataFormat(String secureTag, boolean secureTagContents,
String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters, String keyPassword) {
+ this(secureTag, secureTagContents);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
+ this.setKeyPassword(keyPassword);
+ }
/**
* @deprecated use {{@link #XMLSecurityDataFormat(String, Map, boolean,
String, String, String, String)} or
@@ -167,6 +189,29 @@ public class XMLSecurityDataFormat exten
this.setNamespaces(namespaces);
this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
}
+
+ public XMLSecurityDataFormat(String secureTag, Map<String, String>
namespaces, boolean secureTagContents, String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String
keyOrTrustStoreParametersId, String keyPassword) {
+ this(secureTag, secureTagContents);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setNamespaces(namespaces);
+ this.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ this.setKeyPassword(keyPassword);
+ }
+
+ public XMLSecurityDataFormat(String secureTag, Map<String, String>
namespaces, boolean secureTagContents, String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters, String keyPassword) {
+ this(secureTag, secureTagContents);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setNamespaces(namespaces);
+ this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
+ this.setKeyPassword(keyPassword);
+ }
+
@Override
protected void configureDataFormat(DataFormat dataFormat) {
@@ -203,6 +248,9 @@ public class XMLSecurityDataFormat exten
if (namespaces != null) {
setProperty(dataFormat, "namespaces", this.namespaces);
}
+ if (keyPassword != null) {
+ setProperty(dataFormat, "keyPassword", this.getKeyPassword());
+ }
}
public String getXmlCipherAlgorithm() {
@@ -267,7 +315,14 @@ public class XMLSecurityDataFormat exten
private void setKeyOrTrustStoreParameters(KeyStoreParameters
keyOrTrustStoreParameters) {
this.keyOrTrustStoreParameters = keyOrTrustStoreParameters;
-
+ }
+
+ private String getKeyPassword() {
+ return this.keyPassword;
+ }
+
+ private void setKeyPassword(String keyPassword) {
+ this.keyPassword = keyPassword;
}
@Override
Modified:
camel/trunk/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java?rev=1378476&r1=1378475&r2=1378476&view=diff
==============================================================================
---
camel/trunk/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
(original)
+++
camel/trunk/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
Wed Aug 29 08:36:27 2012
@@ -110,6 +110,7 @@ public class XMLSecurityDataFormat imple
private String keyStorePassword;
private String trustStorePassword;
private String recipientKeyAlias;
+ private String keyPassword;
private KeyStoreParameters keyOrTrustStoreParameters;
private String keyOrTrustStoreParametersId;
@@ -203,7 +204,19 @@ public class XMLSecurityDataFormat imple
this.setKeyCipherAlgorithm(keyCipherAlgorithm);
this.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
}
-
+
+ public XMLSecurityDataFormat(String secureTag, boolean secureTagContents,
String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String
keyOrTrustStoreParametersId, String keyPassword) {
+ this();
+ this.setSecureTag(secureTag);
+ this.setSecureTagContents(secureTagContents);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ this.setKeyPassword(keyPassword);
+ }
+
public XMLSecurityDataFormat(String secureTag, Map<String, String>
namespaces, boolean secureTagContents, String recipientKeyAlias,
String xmlCipherAlgorithm, String keyCipherAlgorithm, String
keyOrTrustStoreParametersId) {
this();
@@ -217,7 +230,22 @@ public class XMLSecurityDataFormat imple
this.keyOrTrustStoreParametersId = keyOrTrustStoreParametersId;
}
}
-
+
+ public XMLSecurityDataFormat(String secureTag, Map<String, String>
namespaces, boolean secureTagContents, String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String
keyOrTrustStoreParametersId, String keyPassword) {
+ this();
+ this.setSecureTag(secureTag);
+ this.setSecureTagContents(secureTagContents);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setNamespaces(namespaces);
+ if (null != keyOrTrustStoreParametersId &&
!keyOrTrustStoreParametersId.equals("")) {
+ this.keyOrTrustStoreParametersId = keyOrTrustStoreParametersId;
+ }
+ this.setKeyPassword(keyPassword);
+ }
+
public XMLSecurityDataFormat(String secureTag, boolean secureTagContents,
String recipientKeyAlias,
String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters) {
this();
@@ -229,6 +257,18 @@ public class XMLSecurityDataFormat imple
this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
}
+ public XMLSecurityDataFormat(String secureTag, boolean secureTagContents,
String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters, String keyPassword) {
+ this();
+ this.setSecureTag(secureTag);
+ this.setSecureTagContents(secureTagContents);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
+ this.setKeyPassword(keyPassword);
+ }
+
public XMLSecurityDataFormat(String secureTag, Map<String, String>
namespaces, boolean secureTagContents, String recipientKeyAlias,
String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters) {
this();
@@ -240,6 +280,19 @@ public class XMLSecurityDataFormat imple
this.setNamespaces(namespaces);
this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
}
+
+ public XMLSecurityDataFormat(String secureTag, Map<String, String>
namespaces, boolean secureTagContents, String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm,
KeyStoreParameters keyOrTrustStoreParameters, String keyPassword) {
+ this();
+ this.setSecureTag(secureTag);
+ this.setSecureTagContents(secureTagContents);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ this.setNamespaces(namespaces);
+ this.setKeyOrTrustStoreParameters(keyOrTrustStoreParameters);
+ this.setKeyPassword(keyPassword);
+ }
@Override
public void setCamelContext(CamelContext camelContext) {
@@ -477,7 +530,8 @@ public class XMLSecurityDataFormat imple
throw new IllegalStateException("A key store must be defined for
asymmetric key decryption.");
}
- Key keyEncryptionKey = getPrivateKey(this.keyStore,
this.recipientKeyAlias, this.keyStorePassword);
+ Key keyEncryptionKey = getPrivateKey(this.keyStore,
this.recipientKeyAlias,
+ this.keyPassword != null ? this.keyPassword :
this.keyStorePassword);
return decode(exchange, encodedDocument, keyEncryptionKey);
}
@@ -773,4 +827,8 @@ public class XMLSecurityDataFormat imple
public void setNamespaces(Map<String, String> namespaces) {
getNamespaceContext().setNamespaces(namespaces);
}
+
+ public void setKeyPassword(String keyPassword) {
+ this.keyPassword = keyPassword;
+ }
}
Added:
camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest.java?rev=1378476&view=auto
==============================================================================
---
camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest.java
(added)
+++
camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest.java
Wed Aug 29 08:36:27 2012
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.xmlsecurity;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration
+public class SpringXmlSecurityDataFormatWithKeyPasswordTest implements
CamelContextAware {
+
+ CamelContext camelContext;
+
+ TestHelper testHelper = new TestHelper();
+
+
+ @Test
+ public void testPartialPayloadAsymmetricKeyDecryptionCustomNS() throws
Exception {
+ testHelper.testDecryption(TestHelper.NS_XML_FRAGMENT, camelContext);
+ }
+
+
+ @Override
+ public void setCamelContext(CamelContext camelContext) {
+ this.camelContext = camelContext;
+ }
+
+
+ @Override
+ public CamelContext getCamelContext() {
+ return camelContext;
+ }
+
+}
Propchange:
camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
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=1378476&r1=1378475&r2=1378476&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
Wed Aug 29 08:36:27 2012
@@ -302,6 +302,27 @@ public class XMLSecurityDataFormatTest e
});
xmlsecTestHelper.testDecryption(context);
}
+
+ @Test
+ public void testFullPayloadAsymmetricKeyDecryptionWithKeyPassword() throws
Exception {
+
+ final KeyStoreParameters tsParameters = new KeyStoreParameters();
+ tsParameters.setPassword("password");
+ tsParameters.setResource("sender.ts");
+
+ final KeyStoreParameters ksParameters = new KeyStoreParameters();
+ ksParameters.setPassword("password");
+ ksParameters.setResource("recipient-with-key-pass.ks");
+
+ context.addRoutes(new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .marshal().secureXML("", true, "recipient",
testCypherAlgorithm, XMLCipher.RSA_v1dot5, tsParameters).to("mock:encrypted")
+ .unmarshal().secureXML("", true, "recipient",
testCypherAlgorithm, XMLCipher.RSA_v1dot5, ksParameters,
"keyPassword").to("mock:decrypted");
+ }
+ });
+ xmlsecTestHelper.testDecryption(context);
+ }
@Test
public void testPartialPayloadAsymmetricKeyDecryption() throws Exception {
Added:
camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml?rev=1378476&view=auto
==============================================================================
---
camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
(added)
+++
camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
Wed Aug 29 08:36:27 2012
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
+ http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd" >
+
+ <!-- key store configuration -->
+ <camel:keyStoreParameters id="keyStoreParams"
resource="./recipient-with-key-pass.ks" password="password" />
+
+ <!-- trust store configuration -->
+ <camel:keyStoreParameters id="trustStoreParams" resource="./sender.ts"
password="password"/>
+
+ <!-- This route demonstrates the XML spring configuration of
partial-payload encryption and decryption for
+ an XML document with namespaces. The domain namespace prefix
(cheese) is declared in the camel context
+ definition and can be used in the secureTag selector that defines
the content to encrypt or decrypt
+ -->
+ <camelContext id="springXmlSecurityDataFormatTestCamelContext"
+ xmlns="http://camel.apache.org/schema/spring"
+ xmlns:cheese="http://cheese.xmlsecurity.camel.apache.org/">
+ <route>
+ <from uri="direct://start"/>
+ <marshal>
+ <secureXML
+ secureTag="//cheese:cheesesites/italy"
+ secureTagContents="true"
+
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
+ recipientKeyAlias="recipient"
+ keyOrTrustStoreParametersId="trustStoreParams" />
+ </marshal>
+ <to uri="mock:encrypted"/>
+ <to uri="direct://encrypted"/>
+ </route>
+ <route>
+ <from uri="direct://encrypted"/>
+ <unmarshal>
+ <secureXML
+ secureTag="//cheese:cheesesites/italy"
+ secureTagContents="true"
+
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
+ recipientKeyAlias="recipient"
+ keyOrTrustStoreParametersId="keyStoreParams"
+ keyPassword="keyPassword"/>
+ </unmarshal>
+ <to uri="mock://decrypted"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange:
camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
camel/trunk/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
camel/trunk/components/camel-xmlsecurity/src/test/resources/recipient-with-key-pass.ks
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlsecurity/src/test/resources/recipient-with-key-pass.ks?rev=1378476&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
camel/trunk/components/camel-xmlsecurity/src/test/resources/recipient-with-key-pass.ks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream