Announcement Announcement Module
No announcement yet.
XMLSecurityException: Cannot create ds:SignatureMethod from SignatureMethod. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • XMLSecurityException: Cannot create ds:SignatureMethod from SignatureMethod.


    I am trying to use Apache XML Security through Spring web services 1.5.6 (WSS4JInterceptor) to digitally sign messages.

    At runtime I get the following exception: (I have to suppress the XML URL in the exception as the forum do not let you post URLs for your first post.)

    ERROR o.a.w.s.message.WSSecSignature - ption: Cannot create a xmldsig#:ds:SignatureMethod from a xmldsig#:SignatureMethod element
    at$I nternedNsChecker.guaranteeThatElementInCorrectSpac e(Unknown Source)
    at eeThatElementInCorrectSpace(Unknown Source)
    at<init>( Unknown Source)
    at y.<init>(Unknown Source)
    at<init >(Unknown Source)
    at thm.<init>(Unknown Source)
    at<init >(Unknown Source)
    at<in it>(Unknown Source)
    at are(
    at d(
    at ute(
    at ction(
    at ndler.doSenderAction(
    at curityInterceptor.secureMessage(Wss4jSecurityInter

    I downloaded wssj-1.5.5 and xmlsec-1.4.2 source code to understand what's going on. Trying to construct XMLSignature in throws the exception:

    SignatureAlgorithm signatureAlgorithm = new SignatureAlgorithm(doc, sigAlgo);
    sig = new XMLSignature(doc, null, signatureAlgorithm.getElement(), canonElem);

    _constructionElement of signatureAlgorithm instance looks something like: <ds:SignatureMethod...../>. I am assuming, while creating instance of XMLSignature the guaranteeThatElementInCorrectSpace() method tries to compare <SignatureMethod.../> with <ds:SignatureMethod../> and hence the exception. For some reason the "ds" prefix does not get set in the call to XMLSignature's constructor.

    Not sure if this is due to Wss4JInterceptor configuration, or conflicting jars or plain bug in wss4j-1.5.5 or xmlsec-1.4.2.

    Could some one please guide.