XML Security componentPage edited by Franz ForsthoferChanges (12)
Full ContentXML Security componentAvailable as of Camel 2.12.0 With this Apache Camel component, you can generate and validate XML signatures as described in the W3C standard XML Signature Syntax and Processing or as described in the successor version 1.1. For XML Encryption support, please refer to the XML Security Data Format. You can find an introduction to XML signature here. The implementation of the component is based on JSR 105, the Java API corresponding to the W3C standard and supports the Apache Santuario and the JDK provider for JSR 105. The implementation will first try to use the Apache Santuario provider; if it does not find the Santuario provider, it will use the JDK provider. Further, the implementation is DOM based. Maven users will need to add the following dependency to their pom.xml for this component: <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-xmlsecurity</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency>
Basic ExampleThe following example shows the basic usage of the component. from("direct:enveloping").to("xmlsecurity:sign://enveloping?keyAccessor=#accessor", "xmlsecurity:verify://enveloping?keySelector=#selector","mock:result") In Spring XML: <from uri="direct:enveloping" /> <to uri="xmlsecurity:sign://enveloping?keyAccessor=#accessor" /> <to uri="xmlsecurity:verify://enveloping?keySelector=#selector" /> <to uri="mock:result" /> For the signing process, a private key is necessary. You specify a key accessor bean which provides this private key. For the validation, the corresponding public key is necessary; you specify a key selector bean which provides this public key. The key accessor bean must implement the KeyAccessor interface. The package org.apache.camel.component.xmlsecurity.api contains the default implementation class DefaultKeyAccessor which reads the private key from a Java keystore. The key selector bean must implement the javax.xml.crypto.KeySelector interface. The package org.apache.camel.component.xmlsecurity.api contains the default implementation class DefaultKeySelector which reads the public key from a keystore. In the example, the default signature algorithm http://www.w3.org/2000/09/xmldsig#rsa-sha1 is used. You can set the signature algorithm of your choice by the option signatureAlgorithm (see below). The signer endpoint creates an enveloping XML signature. If you want to create an enveloped XML signature then you must specify the parent element of the Signature element; see option parentLocalName for more details. Common Signing and Verifying OptionsThere are options which can be used for both endpoints, signer and verifier.
Signing OptionsThe signer endpoint has the following options.
Verifying OptionsThe verifier endpoint has the following options.
Output Node Determination in Enveloping XML Signature CaseAfter the validation the node is extracted from the XML signature document which is finally returned to the output-message body. In the enveloping XML signature case, the default implementation DefaultXmlSignature2Message of XmlSignature2Message does this for the node search type "Default" in the following way (see option xmlSignature2Message): First an Object reference is determined:
Then, the Object is dereferenced and the Object must only contain one XML element. This element is returned as output node. 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 one XML element which is 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 is extracted to the message body --> </Object> <!-- further object elements possible which are not referenced --> ... (<KeyInfo>)? </Signature> See Also
Stop watching space
|
Change email notification preferences
View Online
|
View Changes
|
[CONF] Apache Camel > XML Security component
Franz Forsthofer (Confluence) Wed, 09 Oct 2013 00:01:58 -0700
- [CONF] Apache Camel > XML Security com... Colm O hEigeartaigh (Confluence)
- [CONF] Apache Camel > XML Securit... Franz Forsthofer (Confluence)
- [CONF] Apache Camel > XML Securit... Franz Forsthofer (Confluence)
- [CONF] Apache Camel > XML Securit... Franz Forsthofer (Confluence)
- [CONF] Apache Camel > XML Securit... Franz Forsthofer (Confluence)
- [CONF] Apache Camel > XML Securit... Franz Forsthofer (Confluence)
- [CONF] Apache Camel > XML Securit... Franz Forsthofer (Confluence)
- [CONF] Apache Camel > XML Securit... Franz Forsthofer (Confluence)