Sorry, I missed the metadata file. Attached is the one also used in Shibboleth unit test. I also tried to run the test against other metadata, still the same error.<br><br clear="all">Yaowen<br>
<br><br><div class="gmail_quote">On Thu, Nov 1, 2012 at 10:48 AM, Yaowen Tu <span dir="ltr">&lt;<a href="mailto:yaowen.tu@gmail.com" target="_blank">yaowen.tu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Brent,<br><br>In order to better investigate the problem, I have simplified my code into a single class. Attached is the code that produce the same error. It has everything. I am using OpenSAML 2.5.3. If possible, could you please take a look?<br>


<br>Regarding the other question,  if I understand correctly, you said suppose the key to sign the metadata is the same as the one used for SAML operations, then we need to use X.509 Cert + PKIX to verify the key, is that correct? I am a little confused. I thought no matter whether we use the same key or not, we still need to trust the key used to sign the metadata either by PKIX or other ways. After we verify the signature of the metadata, then we know everything in the metadata is trusted, then we don&#39;t care if the key used for SAML operation is the same as the key for signature, we just use it. Is there anything wrong?<br>


<br>Thanks,<br clear="all">Yaowen<div class="HOEnZb"><div class="h5"><br>
<br><br><div class="gmail_quote">On Thu, Nov 1, 2012 at 9:30 AM, Brent Putman <span dir="ltr">&lt;<a href="mailto:putmanb@georgetown.edu" target="_blank">putmanb@georgetown.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><br>
On 10/31/12 9:27 PM, Yaowen Tu wrote:<br>
&gt; 1. I am not signing and validating the same instance. I write the<br>
&gt; whole metadata to a file, then in step 2, I load it and validate it.<br>
&gt; So I don&#39;t think I am hinting the same issue.<br>
&gt;<br>
<br>
</div>Ok, that should bypass any of the kind of problems I had in mind.<br>
<div><br>
&gt; 2. Even if I just load a testing metadata file, for example<br>
&gt; openid-metadata.xml, which you are using in the unit test as well. I<br>
&gt; still see the same error.<br>
<br>
</div>Yeah, that&#39;s odd.  I really don&#39;t have an explanation for how an<br>
unmarshalled SignableSAMLObject can have a non-null Signature child, but<br>
that Signature child doesn&#39;t have the Apache XMLSignature instance.  The<br>
SignatureUnmarshaller doesn&#39;t really allow that to happen as far as I<br>
can tell.  The answer must lie in something that you haven&#39;t told us or<br>
shown us yet, possibly in something that you are doing before the<br>
signature validation takes place and/or in setting up your environment,<br>
and whatever that is has an odd side-effect.<br>
<div><br>
<br>
&gt; So maybe my code to validate the signature is wrong?<br>
&gt; Here is my code, which is pretty much same as wiki:<br>
&gt;     public void validateSignature(Signature signature, Credential<br>
&gt; validatingCredential) throws ValidationException<br>
&gt;     {<br>
&gt;         SAMLSignatureProfileValidator profileValidator = new<br>
&gt; SAMLSignatureProfileValidator();<br>
&gt;         profileValidator.validate( signature );<br>
&gt;<br>
&gt;         SignatureValidator signatureValidator = new<br>
&gt; SignatureValidator( validatingCredential );<br>
&gt;         // Now try to validate. Throw exception if not valid.<br>
&gt;         signatureValidator.validate( signature );<br>
&gt;     }<br>
&gt;     For testing, validatingCredential is the one I get under the<br>
&gt; &lt;Signature&gt;&lt;KeyInfo&gt; tag. Can you see any problems? Or do you have any<br>
&gt; simple working example that I can look at?<br>
<br>
</div>No problems that I can see, that part looks fine.  I suspect the problem<br>
is something that you are doing before this.<br>
<div><br>
&gt;<br>
&gt; 3. Regarding this sentence: &quot; The KeyDescriptor/KeyInfo is the<br>
&gt; entity&#39;s own key that it uses for SAML purposes, and in the real world<br>
&gt; is very often not the metadata signing key.&quot; We are currently in the<br>
&gt; process of developing a Single Sign On product, can you please tell me<br>
&gt; more about why these two keys are very often no the same?<br>
<br>
<br>
</div>Because it&#39;s often the case that the place/entity/actor that publishes<br>
metadata (and so signs it) is not the entity (or entities) whose<br>
metadata is being published.  The big example is a federation.<br>
<br>
It&#39;s not impossible for an entity to sign its own metadata with the same<br>
key it uses for SAML operations, but then you have to deal with the<br>
obvious question of how the trust fabric works.  One major function of<br>
metadata is to distribute an entity&#39;s key(s), so as to establish the<br>
SAML trust layer; if it signs the metadata with that same key, then how<br>
does the consumer trust that key for purposes of validating the metadata<br>
signature? That&#39;s just pushing the trust problem up another layer.  One<br>
way is to validate the signature not by having trusted the key<br>
explicitly in advance, but by using X.509 cert + PKIX mechanisms with<br>
trust anchors, and some conventions around how the name(s) in the cert<br>
is bound to the signing entity (e.g its SAML entityID).  That&#39;s beyond<br>
the scope of this email however.<br>
<div><div><br>
--<br>
To unsubscribe from this list send an email to <a href="mailto:dev-unsubscribe@shibboleth.net" target="_blank">dev-unsubscribe@shibboleth.net</a><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>