0 Replies Latest reply on Aug 31, 2006 12:18 PM by shadens

    XML signature and KeySelectors class: howto ?

    shadens

      Hi Community,

      I sign a XML message (really, soap message) and then I sent it
      to the server. The server could validate XML signed, but verification
      fails (server say that signature is invalid :( )
      The strange is if I implement signing line code and validate line in
      same class, then all works (and signature is valid);
      I think the problem it is in follow few lines:

      DOMValidateContext valContext = new DOMValidateContext(new
      KeyValueKeySelector(), signatureTag);
      ^^^^^^^^^^^^^^^^^^
       XMLSignature signature =
      sigFactory.unmarshalXMLSignature(valContext);
       // Validate the XMLSignature (generated above)
       boolean isSignatureValid= signature.validate(valContext);
      


      The KeyValueKeySelector is a private static class (within main
      classes) that extends KeySelectors. It seems on client side method of
      this class are executed automatically and validate the signature; if I
      move validation on server side, this class seems not is automatically
      executed
      O_o
      What is the magic of KeySelectors class??

      Thanks to all!

      P.s.
      Ide: netbeans 5.5
      AS: Sun Application Server 9.0
      package: XML Signature Api