Hi Milan,

Milan Tomic wrote:
I'm using XMLSignature ctor like this:

XMLSignature sig = new XMLSignature(doc, BaseURI, docSig, docCan);

and got the following error:

org.apache.xml.security.exceptions.XMLSecurityException: Cannot create a http://www.w3.org/2000/09/xmldsig#:Signature from a http://www.w3.org/2000/09/xmldsig#:SignatureMethod element

at org.apache.xml.security.utils.ElementProxy.guaranteeThatElementInCorrectSpace(Unknown Source)

      at org.apache.xml.security.utils.ElementProxy.<init>(Unknown Source)

      at org.apache.xml.security.algorithms.Algorithm.<init>(Unknown Source)

at org.apache.xml.security.algorithms.SignatureAlgorithm.<init>(Unknown Source)

      at org.apache.xml.security.signature.SignedInfo.<init>(Unknown Source)

at org.apache.xml.security.signature.XMLSignature.<init>(Unknown Source)

I have checked node names with:

System.out.println(docSig.getNodeName());

System.out.println(docCan.getNodeName());

and the output is:

ds:Signature

ds:CanonicalizationMethod

Does anyone have some idea what could be wrong?

Yes, the docSig parameter should be the SignatureMethod element and not the Signature element.

--Sean

Reply via email to