Hello Ayache, you can do this by implementing your own KeyAccessor. The KeyAccessor interface https://github.com/apache/camel/blob/master/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/KeyAccessor.java contains the method
KeyInfo getKeyInfo(Message message, Node messageBody, KeyInfoFactory keyInfoFactory) throws Exception; which returns the KeyInfo element. An example implementation is given by https://github.com/apache/camel/blob/master/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/DefaultKeyAccessor.java which returns the total certificate chain. So you have to adapt this example to your needs. Best Regards Franz On Wed, Apr 26, 2017 at 10:25 PM, ayache.k <[email protected]> wrote: > Thanks for your reply. My query is around Camel XML security component. I > wanted to know if it is possible to generate the *X509Certificate* element > in the *Signature* element - see below example. > Of course I can use Java API/Bouncycastle to generate, but that's last > resort. > > <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> > <SignedInfo> > <CanonicalizationMethod > Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/> > <SignatureMethod > Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> > <Reference URI=""> > <Transforms> > <Transform > Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> > </Transforms> > <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> > <DigestValue>tVicGh6V+8cHbVYFIU91o5+L3OQ=</DigestValue> > </Reference> > </SignedInfo> > <SignatureValue> > dJDHiGQMaKN8iPuWApAL57eVnxz2BQtyujwfPSgE7HyKoxYtoRB97ocxZ > 8ZU440wHtE39ZwRGIjvwor3WfURxnIgnI1CChMXXwoGpHH//Zc0z4ejaz > DuCNEq4Mm4OUVTiEVuwcWAOMkfDHaM82awYQiOGcwMbZe38UX0oPJ2DOE= > </SignatureValue> > <KeyInfo> > <X509Data> > <X509SubjectName> > CN=My Name,O=Test Certificates Inc.,C=US > </X509SubjectName> > <X509Certificate> > MIIB9zCCAWCgAwIBAgIERZwdkzANBgkqhkiG9w0BAQUFADBAMQswCQYD > VQQGEwJVUzEfMB0GA1UEChMWVGVzdCBDZXJ0aWZpY2F0ZXMgSW5jLjEQ > MA4GA1UEAxMHTXkgTmFtZTAeFw0wNzAxMDMyMTE4MTFaFw0zMTA4MjUy > ... > </X509Certificate> > </X509Data> > </KeyInfo> > </Signature> > > > > -- > View this message in context: http://camel.465427.n5.nabble. > com/XMLSecurity-not-generating-tp5798321p5798363.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
