You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Ri...@syntegra.com on 2005/03/09 20:36:14 UTC

Somone... help... please ...

Hello All,
 
(Raul, Berin, someone listen to me ...)
 
I have managed to generated the XML DSig and embed it into the required
document at the location desired
(There is a requirement for the dsig element to be present at a fixed
location in the document)
 
Now when I try to verify the signature, obviously I have to select the
element using xpath
If the DocumentBuilderFactory object is set to namespaceAware(true), the
xpath just wont evaluate, coz of namespace problems
(I ve tried a lot of things from my limited knowledge, but it just wont
evaluate)
 
It evaluates when the namespaceAware(false) , but then it throws this error 
 
org.apache.xml.security.exceptions.XMLSecurityException: Cannot create a
null:null from a http://www.w3.org/2000/09/xmldsig#:Signature element
 
What is the way out?
 
I have this code due for delivery like real soon, can someone please take
time out and lemme know how to get it to work ?
I ve completely run out of ideasssssss
 
Best Always,
.............................................................................
...........................................
Ritesh Aswaney
* Mobile: +44 7909540132
.............................................................................
............................................ 
 


********************************************************************

This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person
Thank you

Check us out at http://www.bt.com/consulting

********************************************************************


Re: Somone... help... please ...

Posted by Heiner Westphal <He...@verit.de>.
Ritesh,

leaving the namepaceAware on true and use some ugly XPath like
"//*[local-name()='Header']/*[local-name()='SenderInfo']/*[local-name()='SenderID']"
will match the node you would have called
"//Header/SenderInfo/SenderID" in absence of namespaces.

Sadly it matches nodes even in the wrong namespace, but that is usualy 
not a problem, because its not common to mix the same element names from 
different namespaces.

Dont know if it works in your case, but I would give it a try.

Regards,

Heiner

Ritesh.Aswaney@syntegra.com wrote:
> Hello All,
> 
>  
> 
> (Raul, Berin, someone listen to me …)
> 
>  
> 
> I have managed to generated the XML DSig and embed it into the required 
> document at the location desired
> 
> (There is a requirement for the dsig element to be present at a fixed 
> location in the document)
> 
>  
> 
> Now when I try to verify the signature, obviously I have to select the 
> element using xpath
> 
> If the DocumentBuilderFactory object is set to 
> *namespaceAware**(**true)*, the xpath just wont evaluate, coz of 
> namespace problems
> 
> (I ve tried a lot of things from my limited knowledge, but it just wont 
> evaluate)
> 
>  
> 
> It evaluates when the *namespaceAware**(**false) *, but then it throws 
> this error
> 
>  
> 
> org.apache.xml.security.exceptions.XMLSecurityException: Cannot create a 
> null:null from a http://www.w3.org/2000/09/xmldsig#:Signature element
> 
>  
> 
> What is the way out?
> 
>  
> 
> I have this code due for delivery like real soon, can someone please 
> take time out and lemme know how to get it to work ?
> 
> I ve completely run out of ideasssssss
> 
>  
> 
> Best Always,
> ........................................................................................................................
> 
> *Ritesh Aswaney*
> ( Mobile: +44 7909540132
> 
> ......................................................................................................................... 
> 
> 
>  
> 
> |
> 
> ********************************************************************
> 
> This email may contain information which is privileged or confidential. 
> If you are not the intended recipient of this email, please notify the 
> sender immediately and delete it without reading, copying, storing, 
> forwarding or disclosing its contents to any other person
> Thank you
> 
> Check us out at http://www.bt.com/consulting
> 
> ********************************************************************
> |


Re: Somone... help... please ...

Posted by Raul Benito <ra...@gmail.com>.
Ok,
You must put always namespaceAware(true), for fixing your xpath
problems is recommended to do something like that:

Element nscontext = XMLUtils.createDSctx(doc, "ds",
                                                     Constants.SignatureSpecNS);

            //retrieve the signature Element from the document
            Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
                                    "//ds:Signature[1]", nscontext);

Please note how it creates a node and see how it binds to a URI, and
then how it does the search.

I think this will fix your problems.

This example was taken from the samples in the xml-sec, but it is also
described in the xalan faq.

Regards,

Raul

On Wed, 9 Mar 2005 19:36:14 -0000, Ritesh.Aswaney@syntegra.com
<Ri...@syntegra.com> wrote:
>  
>  
> 
> Hello All, 
> 
>   
> 
> (Raul, Berin, someone listen to me …) 
> 
>   
> 
> I have managed to generated the XML DSig and embed it into the required
> document at the location desired 
> 
> (There is a requirement for the dsig element to be present at a fixed
> location in the document) 
> 
>   
> 
> Now when I try to verify the signature, obviously I have to select the
> element using xpath 
> 
> If the DocumentBuilderFactory object is set to namespaceAware(true), the
> xpath just wont evaluate, coz of namespace problems 
> 
> (I ve tried a lot of things from my limited knowledge, but it just wont
> evaluate) 
> 
>   
> 
> It evaluates when the namespaceAware(false) , but then it throws this error 
> 
>   
> 
> org.apache.xml.security.exceptions.XMLSecurityException: Cannot create a
> null:null from a http://www.w3.org/2000/09/xmldsig#:Signature element 
> 
>   
> 
> What is the way out? 
> 
>   
> 
> I have this code due for delivery like real soon, can someone please take
> time out and lemme know how to get it to work ? 
> 
> I ve completely run out of ideasssssss 
> 
>   
> 
> Best Always,
> ........................................................................................................................
> 
> Ritesh Aswaney
>  ( Mobile: +44 7909540132 
> 
> .........................................................................................................................
> 
>   
>  
>  ********************************************************************
>  
>  This email may contain information which is privileged or confidential. If
> you are not the intended recipient of this email, please notify the sender
> immediately and delete it without reading, copying, storing, forwarding or
> disclosing its contents to any other person
>  Thank you
>  
>  Check us out at http://www.bt.com/consulting
>  
>  ********************************************************************
>  


-- 
http://r-bg.com