Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Option

Default

Description

secureTag

null

The XPATH reference to the XML the XML Element selected for encryption/decryption.
If no tag is specified, the entire the entire payload is encryptedis 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 --> XML Element

  • false = Element Level
 
          - true  -->
  • true = Element Content
Level 
  • Level

passPhrase

null

A byte array that is String used as passPhrase to encrypt/decrypt content. The passPhrase has to has to be
If no passPhrase is provided. If no passPhrase is specified, a default passPhrase is utilized. The passPhrase needs used. The passPhrase needs to be put together in conjunction
with the appropriate encryption algorithm
          - TRIPLEDES (example: appropriate encryption algorithm. For example using TRIPLEDES the passPhase can be a "Only another 24 Byte key".getBytes()           

xmlCipherAlgorithm

null TRIPLEDES

The cipher The cipher algorithm to be used for encryption/decryption.
The available choices are
          - XMLCipher.TRIPLEDES 
          - :

  • XMLCipher.TRIPLEDES
  • XMLCipher.AES_128
          -
  • XMLCipher.AES_192
          -
  • XMLCipher.AES_256
If xmlCipherAlgorithm is not explicitly specified the cipher algorithm employed is XMLCipher.TRIPLEDES

Marshal

In order to encrypt the payload, the marshal the marshal processor needs to be applied on the route followed by the secureXML() tag.

Unmarshal

In order to decrypt the payload, the unmarshal the unmarshal processor needs to be applied on the route followed by the secureXML() tag.

Examples  Examples

Given below are several examples of how marshalling could be performaed at the Document, Element and Content levels.

Full Payload encryption/decryption

Code Block

from("direct:start").
    marshal().secureXML().
    unmarshal().secureXML().
to("direct:end");

Partial Payload Content Only encryption/decryption*

Code Block

String tagXPATH = "//cheesesites/italy/cheese";
boolean secureTagContent = true;
...
from("direct:start").
    marshal().secureXML(tagXPATH , secureTagContent ).
    unmarshal().secureXML(tagXPATH , secureTagContent).
to("direct:end");

Partial Multi Node Payload Content Only encryption/decryption*

Code Block

String tagXPATH = "//cheesesites/*/cheese";
boolean secureTagContent = true;
....
from("direct:start").
    marshal().secureXML(tagXPATH , secureTagContent ).
    unmarshal().secureXML(tagXPATH , secureTagContent).
to("direct:end");

Partial Payload Content Only encryption/decryption with choice of passPhrase(password)*

Code Block

String tagXPATH = "//cheesesites/italy/cheese";
boolean secureTagContent = true;
....
String passPhrase = "Just another 24 Byte key";
from("direct:start").
    marshal().secureXML(tagXPATH , secureTagContent , passPhrase).
    unmarshal().secureXML(tagXPATH , secureTagContent, passPhrase).
to("direct:end");

Partial Payload Content Only encryption/decryption with passPhrase(password) and Algorithm* 

Code Block

import org.apache.xml.security.encryption.XMLCipher;
....
String tagXPATH = "//cheesesites/italy/cheese";
boolean secureTagContent = true;
String passPhrase = "Just another 24 Byte key";
String algorithm= XMLCipher.TRIPLEDES;
from("direct:start").
    marshal().secureXML(tagXPATH , secureTagContent , passPhrase, algorithm).
    unmarshal().secureXML(tagXPATH , secureTagContent, passPhrase, algorithm).
to("direct:end");

Dependencies

This data format is provided in the camel-xmlsecurity component.