Author: hadrian
Date: Tue Jun 21 00:56:59 2011
New Revision: 1137833
URL: http://svn.apache.org/viewvc?rev=1137833&view=rev
Log:
CAMEL-4061. Port to the 2.7.x branch
Modified:
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
Modified:
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java?rev=1137833&r1=1137832&r2=1137833&view=diff
==============================================================================
---
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
(original)
+++
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
Tue Jun 21 00:56:59 2011
@@ -348,7 +348,15 @@ public class DataFormatClause<T extends
XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
secureTagContents, passPhrase, xmlCipherAlgorithm);
return dataFormat(xsdf);
}
-
+
+ /**
+ * Uses the XML Security data format
+ */
+ public T secureXML(String secureTag, boolean secureTagContents, String
recipientKeyAlias, String xmlCipherAlgorithm, String keyCipherAlgorithm) {
+ XMLSecurityDataFormat xsdf = new XMLSecurityDataFormat(secureTag,
secureTagContents, recipientKeyAlias, xmlCipherAlgorithm, keyCipherAlgorithm);
+ return dataFormat(xsdf);
+ }
+
/**
* Uses the xmlBeans data format
*/
Modified:
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java?rev=1137833&r1=1137832&r2=1137833&view=diff
==============================================================================
---
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
(original)
+++
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
Tue Jun 21 00:56:59 2011
@@ -41,6 +41,11 @@ public class XMLSecurityDataFormat exten
private String secureTag;
@XmlAttribute
private Boolean secureTagContents;
+ @XmlAttribute
+ private String keyCipherAlgorithm;
+ @XmlAttribute
+ private String recipientKeyAlias;
+
public XMLSecurityDataFormat() {
super("secureXML");
@@ -61,11 +66,21 @@ public class XMLSecurityDataFormat exten
public XMLSecurityDataFormat(String secureTag, boolean secureTagContents,
String passPhrase,
String xmlCipherAlgorithm) {
- this();
+ this();
this.setSecureTag(secureTag);
this.setSecureTagContents(secureTagContents);
- this.setPassPhrase(passPhrase);
this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
+ }
+
+ public XMLSecurityDataFormat(String secureTag, boolean secureTagContents,
String recipientKeyAlias,
+ String xmlCipherAlgorithm, String keyCipherAlgorithm) {
+ this();
+ this.setSecureTag(secureTag);
+ this.setSecureTagContents(secureTagContents);
+ this.setRecipientKeyAlias(recipientKeyAlias);
+ this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
+ this.setKeyCipherAlgorithm(keyCipherAlgorithm);
}
@Override
@@ -79,7 +94,7 @@ public class XMLSecurityDataFormat exten
setProperty(dataFormat, "secureTagContents", isSecureTagContents());
if (passPhrase != null) {
- setProperty(dataFormat, "passPhrase", getPassPhrase());
+ setProperty(dataFormat, "passPhrase", getPassPhrase().getBytes());
} else {
setProperty(dataFormat, "passPhrase", "Just another 24 Byte
key".getBytes());
}
@@ -88,6 +103,12 @@ public class XMLSecurityDataFormat exten
} else {
setProperty(dataFormat, "xmlCipherAlgorithm", TRIPLEDES);
}
+ if(getKeyCipherAlgorithm() != null) {
+ setProperty(dataFormat, "keyCipherAlgorithm",
getKeyCipherAlgorithm());
+ }
+ if(getRecipientKeyAlias() != null) {
+ setProperty(dataFormat, "recipientKeyAlias",
getRecipientKeyAlias());
+ }
}
public String getXmlCipherAlgorithm() {
@@ -125,4 +146,20 @@ public class XMLSecurityDataFormat exten
public boolean isSecureTagContents() {
return secureTagContents != null && secureTagContents;
}
+
+ public void setKeyCipherAlgorithm(String keyCipherAlgorithm) {
+ this.keyCipherAlgorithm = keyCipherAlgorithm;
+ }
+
+ public String getKeyCipherAlgorithm() {
+ return keyCipherAlgorithm;
+ }
+
+ public void setRecipientKeyAlias(String recipientKeyAlias) {
+ this.recipientKeyAlias = recipientKeyAlias;
+ }
+
+ public String getRecipientKeyAlias() {
+ return recipientKeyAlias;
+ }
}