<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Hi All, </span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I am reposting this message, since it looks like that I sent to the opensaml user mailing list, after a slight misunderstanding, </div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">because of my english! :-)</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<div><br></div><div><div>Using OpenSAML I correctly validate the signature of an assertion that has as Subject Confirmation Data the following </div><div><br></div><p style="margin:0px;font-size:12px;font-family:Helvetica;color:rgb(171,69,0)">
<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(2,29,167)">&lt;wsse:SecurityTokenReference</span><span style="color:rgb(249,151,94)"> </span><span style="color:rgb(0,0,0)"><br></span><span style="color:rgb(249,151,94)">            </span><span style="color:rgb(0,170,214)">xmlns:wsse</span><span style="color:rgb(255,148,80)">=</span>&quot;<a href="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" target="_blank" style="color:rgb(17,85,204)">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</a>&quot;<span style="color:rgb(2,29,167)">&gt;</span><span style="color:rgb(0,0,0)"><br>
            </span><span style="color:rgb(2,29,167)">&lt;wsse:KeyIdentifier</span><span style="color:rgb(249,151,94)"> </span><span style="color:rgb(0,0,0)"><br></span><span style="color:rgb(249,151,94)">                ValueType</span><span style="color:rgb(255,148,80)">=</span>&quot;<a href="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier" target="_blank" style="color:rgb(17,85,204)">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier</a>&quot;<span style="color:rgb(2,29,167)">&gt;</span><span style="color:rgb(0,0,0)"><br>
                Ytig1daWMVvZKbESb1W10TpDcJY=<br>            </span><span style="color:rgb(2,29,167)">&lt;/wsse:KeyIdentifier&gt;</span><span style="color:rgb(0,0,0)"><br></span></p><div><span style="font-family:Helvetica;font-size:12px">        </span><span style="font-family:Helvetica;font-size:12px;color:rgb(2,29,167)">&lt;/wsse:SecurityTokenReference&gt;</span></div>
<div><br></div><div> <br clear="all"><div>When I add this assertion to a newly created security header, DOM is pushing the namespace in the security header element, as:</div><div><br></div><div><p style="color:rgb(171,69,0);font-size:12px;font-family:Helvetica;margin:0px">
<span style="color:rgb(2,29,167)">&lt;wsse:Security</span><span style="color:rgb(249,151,94)"> </span><span style="color:rgb(0,170,214)">xmlns:wsse</span><span style="color:rgb(255,148,80)">=</span>&quot;<a href="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" target="_blank" style="color:rgb(17,85,204)">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</a>&quot;<span style="color:rgb(2,29,167)">&gt;</span><span style="color:rgb(0,0,0)"><br>
            </span><span style="color:rgb(2,29,167)">&lt;saml2:Assertion</span></p><p style="color:rgb(171,69,0);font-size:12px;font-family:Helvetica;margin:0px"><span style="color:rgb(2,29,167)"><br></span></p><p style="color:rgb(171,69,0);font-size:12px;font-family:Helvetica;margin:0px">
<span style="color:rgb(0,0,0);font-family:arial;font-size:small">causing the keyInfo of the Subject Confirmation Data to be: </span></p><p style="color:rgb(171,69,0);font-size:12px;font-family:Helvetica;margin:0px"><span style="color:rgb(0,0,0);font-family:arial;font-size:small"><br>
</span></p><p style="margin:0px"></p><p style="color:rgb(171,69,0);font-size:12px;margin:0px;font-family:Helvetica"><span style="color:rgb(2,29,167)">&lt;wsse:SecurityTokenReference&gt;&lt;wsse:KeyIdentifier</span><span style="color:rgb(249,151,94)"> ValueType</span><span style="color:rgb(255,148,80)">=</span>&quot;<a href="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier" target="_blank" style="color:rgb(17,85,204)">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier</a>&quot;<span style="color:rgb(2,29,167)">&gt;</span><span style="color:rgb(0,0,0)">Ytig1daWMVvZKbESb1W10TpDcJY=</span><span style="color:rgb(2,29,167)">&lt;/wsse:KeyIdentifier&gt;&lt;/wsse:SecurityTokenReference&gt;</span></p>
<p style="color:rgb(171,69,0);font-size:12px;margin:0px;font-family:Helvetica"><span style="color:rgb(2,29,167)"><br></span></p><p style="color:rgb(171,69,0);font-size:12px;margin:0px;font-family:Helvetica"><span style="color:rgb(0,0,0);font-family:arial;font-size:small">and this seems to break the validation of the saml assertion:</span></p>
<p style="color:rgb(171,69,0);font-size:12px;margin:0px;font-family:Helvetica"><span style="color:rgb(0,0,0);font-family:arial;font-size:small"><br></span></p><p style="color:rgb(171,69,0);font-size:12px;margin:0px;font-family:Helvetica">
Caused by: org.opensaml.xml.validation.ValidationException: Signature did not validate against the credential&#39;s key</p><p style="color:rgb(171,69,0);font-size:12px;margin:0px;font-family:Helvetica"><span style="white-space:pre-wrap">        </span>at org.opensaml.xml.signature.SignatureValidator.validate(SignatureValidator.java:78)</p>
<p style="color:rgb(171,69,0);font-size:12px;margin:0px;font-family:Helvetica"><span style="color:rgb(0,0,0);font-family:arial;font-size:small"><br></span></p><p style="margin:0px">How to avoid this situation? The assertion&#39;s SignedInfo is: </p>
<p style="margin:0px"><br></p><p style="margin:0px"></p><p style="margin:0px">          &lt;ds:SignedInfo&gt;</p><p style="margin:0px">            &lt;ds:CanonicalizationMethod Algorithm=&quot;<a href="http://www.w3.org/2001/10/xml-exc-c14n#" target="_blank" style="color:rgb(17,85,204)">http://www.w3.org/2001/10/xml-exc-c14n#</a>&quot;/&gt;</p>
<p style="margin:0px">            &lt;ds:SignatureMethod Algorithm=&quot;<a href="http://www.w3.org/2000/09/xmldsig#rsa-sha1" target="_blank" style="color:rgb(17,85,204)">http://www.w3.org/2000/09/xmldsig#rsa-sha1</a>&quot;/&gt;</p>
<p style="margin:0px">            &lt;ds:Reference URI=&quot;#uuid-d8840a0d-fa90-4522-806e-edc8dc427d2b&quot;&gt;</p><p style="margin:0px">              &lt;ds:Transforms&gt;</p><p style="margin:0px">                &lt;ds:Transform Algorithm=&quot;<a href="http://www.w3.org/2000/09/xmldsig#enveloped-signature" target="_blank" style="color:rgb(17,85,204)">http://www.w3.org/2000/09/xmldsig#enveloped-signature</a>&quot;/&gt;</p>
<p style="margin:0px">                &lt;ds:Transform Algorithm=&quot;<a href="http://www.w3.org/2001/10/xml-exc-c14n#" target="_blank" style="color:rgb(17,85,204)">http://www.w3.org/2001/10/xml-exc-c14n#</a>&quot;/&gt;</p>
<p style="margin:0px">              &lt;/ds:Transforms&gt;</p><p style="margin:0px">              &lt;ds:DigestMethod Algorithm=&quot;<a href="http://www.w3.org/2000/09/xmldsig#sha1" target="_blank" style="color:rgb(17,85,204)">http://www.w3.org/2000/09/xmldsig#sha1</a>&quot;/&gt;</p>
<p style="margin:0px">              &lt;ds:DigestValue&gt;ghAD3gMLcZvyXFhVXJwNkeHCGi8=&lt;/ds:DigestValue&gt;</p><p style="margin:0px">            &lt;/ds:Reference&gt;</p><p style="margin:0px">          &lt;/ds:SignedInfo&gt;</p>
<p style="margin:0px"><br></p><p style="margin:0px">AFAIK, the two xmls are semantically equivalent, thus the signature shall behave the same, or am I wrong?</p></div></div></div></div><div><br></div>-- <br>Massimiliano Masi<br>
<br><a href="http://www.mascanc.net/~max">http://www.mascanc.net/~max</a><br>