Class DefaultXmlSignature2Message

java.lang.Object
org.apache.camel.component.xmlsecurity.api.DefaultXmlSignature2Message
All Implemented Interfaces:
XmlSignature2Message

public class DefaultXmlSignature2Message extends Object implements XmlSignature2Message
Maps the XML signature to a camel message. A output node is determined from the XML signature document via a node search and then serialized and set to the output message body.

There are three output node search types supported: "Default", "ElementName", and "XPath". All these search types support enveloped XML signature or enveloping XML signature.

  • The "ElementName" search uses the local name and namespace specified in the search value to determine the output element from the XML signature document. With the input parameter 'RemoveSignatureElements", you can specify whether the signature elements should be removed from the resulting output document. This flag shall be used for enveloped XML signatures.
  • The "XPath" search uses an XPath expression to evaluate the output node. In this case the output node can be of type Element, TextNode, or Document. With the input parameter 'RemoveSignatureElements", you can specify whether the signature elements should be removed from the resulting output document. This flag shall be used for enveloped XML signatures.
  • The "Default" search is explained in more detail below.

Default Output Node Search:

    In the enveloped XML signature case, the XML document without the signature part is returned in the message body.

    In the enveloping XML signature case, the message body is determined from a referenced Object element in the following way:

    • Only same document references are taken into account (URI must start with '#').
    • Also indirect same document references to an object via manifest are taken into account.
    • The resulting number of object references must be 1.
    • The referenced object must contain exactly 1 DOMStructure.
    • The node of the DOMStructure is serialized to a byte array and added as body to the message.
    This does mean that the enveloping XML signature must have either the structure
         
         <Signature>
             <SignedInfo>
                <Reference URI="#object"/>
                <!-- further references possible but they must not point to an Object or Manifest containing an object reference -->
                ...
             </SignedInfo>
    
             <Object Id="object">
                  <!-- contains the DOM node which should be extracted to the message body -->
             <Object>
             <!-- further object elements possible which are not referenced-->
             ...
             (<KeyInfo>)?
         </Signature>
         
     
    or the structure
         
         <Signature>
             <SignedInfo>
                <Reference URI="#manifest"/>
                <!-- further references  are possible but they must not point to an Object or other manifest containing an object reference -->
                ...
             </SignedInfo>
    
             <Object >
                <Manifest Id="manifest">
                   <Reference URI=#object/>
                </Manifest>
             </Objet>
             <Object Id="object">
                 <!-- contains the DOM node which should be extracted to the message body -->
             </Object>
              <!-- further object elements possible which are not referenced -->
             ...
             (<KeyInfo>)?
         </Signature>