acarlstein
acarlstein

Reputation: 1838

xmlsec 2.0.4: Cannot Resolve method setSignatureSpecNSprefix

I updated from xmlsec 1.2.0 to 2.0.4 since I am moving from Java 7 to Java 8.

Now, the issue I am encountering is that the method setSignatureSpecNSprefix as being removed from org.apache.xml.security.utils.Constants.

I can't find any documentation that tells me how to replace it or how to go around it.

I asked already in the mailing list and the JIRA of Apache but no luck so far.

In my code, I used to do:

import org.apache.xml.security.utils.Constants;
...
protected final void sign(String signedElementID, Element signedElement)
throws XMLSecurityException {
  // Setting some attributes for ID, AssertionID and ResponseID
  // ...

  // Here is where it blows up!!! 
  Constants.setSignatureSpecNSprefix("");

  // The BaseURI is the URI that's used to prepend to relative URIs
  String BaseURI = "http://someurl.com"; 

  Document document = signedElement.getOwnerDocument();

  // It shouldn't affect the signature, 
  // because we don't have any relative URLs in the document
  XMLSignature sig = new XMLSignature(doc, 
                                    BaseURI, 
                                    XMLSignature.ALGO_ID_SIGNATURE_RSA,
                                Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS);

Thank you for any help you can provide.

Upvotes: 0

Views: 465

Answers (1)

acarlstein
acarlstein

Reputation: 1838

Supposedly, we can replace

    Constants.setSignatureSpecNSprefix("");

with

    ElementProxy.setDefaultPrefix(Constants.SignatureSpecNS, "");

and obtain the same result.

Upvotes: 0

Related Questions