title: Signature Validation issues using OpenSAML & OpenSSO
body: <p>We are using OpenSAML on the Service Provider Site to provide SSO for our clients. Our client(ID Provider) is using OpenSSO on their end. The SAML Response being posted by OpenSSO is a little different when it comes to the signature element in that it is not qualified by the namespace. This doesn't seem to go down well with OpenSAML and it returns a null from the 
  <code>samlResponse.getSignature()</code> method, due to which I cannot validate the signature.</p>
  
  <h2>Signature Snippet of the SamlReponse that is causing the issue</h2>
  
  <pre><code>&lt;Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
      &lt;SignedInfo&gt;
          &lt;CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
          &lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /&gt;
          &lt;Reference URI="#s2d10cccbd58d1f78c2c76c74c82a236548c929ffd"&gt;
              &lt;Transforms&gt;
                  &lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /&gt;
                  &lt;Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
              &lt;/Transforms&gt;
              &lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /&gt;
              &lt;DigestValue&gt;j+KBoDOtEcyCquPTxRCXoBulStQ=&lt;/DigestValue&gt;
          &lt;/Reference&gt;
      &lt;/SignedInfo&gt;
      &lt;SignatureValue&gt;Dv+owuZfGFymGGrw2gHA3/7GVC6mXt8JMW+tOvmtnjTRJZaDE+Nb2NCngio1Tnqu4LWnvVrry4Wk... 6QcIJi/kGc4YFMSQj/Q=&lt;/SignatureValue&gt;
      &lt;KeyInfo&gt;
          &lt;X509Data&gt;
              &lt;X509Certificate&gt;MIIEhDCCA+2gAwIBAgIQXxhipi2wpPxWi7MTVfFVHDANBgkqhkiG9w0BAQUFADCBujEfMB0GA1UE... 78Q/lRQuBhHMy02lKctnwjBeEYA=&lt;/X509Certificate&gt;
          &lt;/X509Data&gt;
      &lt;/KeyInfo&gt;
  &lt;/Signature&gt;
  </code></pre>
  
  <hr>
  
  <h2>Signature snippet from another SAML Response that works</h2>
  
  <pre><code>&lt;dsig:Signature xmlns="http://www.w3.org/2000/09/xmldsig#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"&gt;
      &lt;dsig:SignedInfo&gt;
          &lt;dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
          &lt;dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /&gt;
          &lt;dsig:Reference URI="#id-TtLltjcBSOAJ6OipumUEj8o0Qag-"&gt;
              &lt;dsig:Transforms&gt;
                  &lt;dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /&gt;
                  &lt;dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
              &lt;/dsig:Transforms&gt;
              &lt;dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /&gt;
              &lt;dsig:DigestValue&gt;5c95zhA139qzMvZA2A445F3LWaU=&lt;/dsig:DigestValue&gt;
          &lt;/dsig:Reference&gt;
      &lt;/dsig:SignedInfo&gt;
      &lt;dsig:SignatureValue&gt;JsmRFJn1CjClHs4rf0hrwKzOq6ZtmnOEm/PNiaJvYurko/ZP+PApWhk55x0unIVwZ6XDv3k8Dj81WqUl07J0Dkvzp71bccIgiGTRzoNPT71nBAXxJmZiXz51JWctg13zjxP0oQMSpWytKCrFkCkJ0So3RQl3WixYV3miK0YjJnM=&lt;/dsig:SignatureValue&gt;
      &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
      &lt;/ds:KeyInfo&gt;
  &lt;/dsig:Signature&gt;
  </code></pre>
  
  <hr>
  
  <p>As you can see above the signature snippet from the OpenSSO server does not contain the namespace qualifier as specified in the SAML Bindings spec. </p>
  
  <p>The last option for me would be to do some massaging of the SAMLResponse that is posted to prepend the namespace to the signature elements to make the OpenSAML libraries work.</p>
  
  <p>Any ideas on how to solve this using the OpenSAML libraries highly appreciated.</p>
  
  <p>Thanks in advance
  CJ</p>