[CONF] Apache Camel: XMLSecurity DataFormat (page edited)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[CONF] Apache Camel: XMLSecurity DataFormat (page edited)

Dhiraj Bokde (Confluence)

XMLSecurity DataFormat has been edited by Ashwin Karpe (Feb 20, 2009).

(View changes)


The XMLSecurity DataFormat facilitates encryption and decryption of XML payloads at the Document, Element and Element Content levels (including simultaneous multi-node encryption/decryption using XPATH).

The encrytion capability is based on formats supported using the Apache XML Security (Santaurio) project. Encryption/Decryption is "currently" supported using Triple-DES and AES (128, 192 and 256) encryption formats. Additional formats can be easily added later as needed.  (Note: The support currently offered is for symmetric encryption. This means the same keyset is needed at both ends of the communication to encrypt/decrypt payloads).

The capability allows Camel users to encrypt/decrypt payloads while being dispatched or received along a route. 


Option Default Description
secureTag null The XPATH reference to the XML Element selected for encryption/decryption.
If no tag is specified, the entire payload is encrypted/decrypted. 
secureTagContents false A boolean value to specify whether the XML Element is to be encrypted or the contents of the XML Element.   
          - false --> Element Level 
          - true  --> Element Content Level 
passPhrase null A byte array that is used as passPhrase to encrypt/decrypt content. The passPhrase has to be
If no passPhrase is specified, a default passPhrase is utilized. The passPhrase needs to be put together in conjunction
with the appropriate encryption algorithm
          - TRIPLEDES (example: "Only another 24 Byte key".getBytes()  
          - AES_128     (example: byte[] bits128 =
Unknown macro: {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03,(byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,         (byte) 0x08, (byte) 0x09, (byte) 0x0A, (byte) 0x0B, (byte) 0x0C, (byte) 0x0D, (byte) 0x0E, (byte) 0x0F}
          - AES_192     (example: byte[] bits256 =
Unknown macro: {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x0A, (byte) 0x0B, (byte) 0x0C, (byte) 0x0D, (byte) 0x0E, (byte) 0x0F, (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13, (byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17}
          - AES_256     (example: byte[] bits256 = 
Unknown macro: {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03,(byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x0A, (byte) 0x0B, (byte) 0x0C, (byte) 0x0D, (byte) 0x0E, (byte) 0x0F, (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13, (byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17, (byte) 0x18, (byte) 0x19, (byte) 0x1A, (byte) 0x1B, (byte) 0x1C, (byte) 0x1D, (byte) 0x1E, (byte) 0x1F}
xmlCipherAlgorithm null The cipher algorithm to be used for encryption/decryption.
The available choices are. 
          - XMLCipher.TRIPLEDES 
          - XMLCipher.AES_128
          - XMLCipher.AES_192
          - XMLCipher.AES_256

If xmlCipherAlgorithm is not explicitly specified the compressionLevel employed is XMLCipher.TRIPLEDES


In this example we marshal a regular text/XML payload to a compressed payload employing zip compression Deflater.BEST_COMPRESSION and send it an ActiveMQ queue called MY_QUEUE.from("direct:start").marshal().zip(Deflater.BEST_COMPRESSION).to("activemq:queue:MY_QUEUE");
Alternatively if you would like to use the default setting you could send it asfrom("direct:start").marshal().zip().to("activemq:queue:MY_QUEUE");


In this example we unmarshal a zipped payload from an ActiveMQ queue called MY_QUEUE to its original format, and forward it for processing to the UnZippedMessageProcessor. Note that the compression Level employed during the marshalling should be identical to the one employed during unmarshalling to avoid errors.from("activemq:queue:MY_QUEUE").unmarshal().zip().process(new UnZippedMessageProcessor()); 


This data format is provided in camel-core so no additional dependencies is needed.