<div>I haven&#39;t had a chance to get back to trying your suggested fix, but I did open a ticket as requested.</div><div><br></div><font face="courier new,monospace"><a href="https://issues.shibboleth.net/jira/browse/MDA-58">https://issues.shibboleth.net/jira/browse/MDA-58</a><br clear="all">

</font>
<br><br><div class="gmail_quote">On Tue, Jan 24, 2012 at 6:10 AM, Chad La Joie <span dir="ltr">&lt;<a href="mailto:lajoie@itumi.biz">lajoie@itumi.biz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

You&#39;ve correctly diagnosed the problem but not the solution.  The<br>
EntityDescriptorItemIdPopulationStage is meant for something else[1].<br>
<br>
So, for now, you should do two things.  First, file a bug.  Second,<br>
create a stage that generates and sets an ID on an EntityDescriptor or<br>
EntitiesDescriptor (which is what I&#39;ll do when I fix the issue).<br>
<br>
[1] This stage is meant to take the identifier of an EntityDescriptor<br>
and add it to the metadata of the given item.  That is, it takes a<br>
SAML specific thing and copies it to a protocol agnostic location so<br>
that other plugins can work on it.  Once the MDA web service is<br>
available, this is also how it will look up information by ID.<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, Jan 23, 2012 at 23:25, Dan McLaughlin<br>
&lt;<a href="mailto:dmclaughlin@tech-consortium.com">dmclaughlin@tech-consortium.com</a>&gt; wrote:<br>
&gt; The new version of the MDA seemed to work fine, then today I actually<br>
&gt; tried to get our SP to consume the metadata it aggregated and signed,<br>
&gt; but every time I enabled the Signature MetadataFilter to validate the<br>
&gt; signature I would get an error telling me &quot;CRIT Shibboleth.Application<br>
&gt; : error initializing MetadataProvider: SignatureMetadataFilter unable<br>
&gt; to verify signature at root of metadata instance.&quot;<br>
&gt;<br>
&gt; I assumed maybe my private/public key pair I was using to sign and<br>
&gt; validate the metadata was bad, so I used openssl to verify that the<br>
&gt; private key I used with the MDA to sign the metadata matched the<br>
&gt; public key I was using in the SP to validate the signature.  Long<br>
&gt; story short, openssl confirmed they matched.<br>
&gt;<br>
&gt; Then I used xmlsectool to validate the signature on the metadata<br>
&gt; generated by MDA and it complained as well, but gave me a little more<br>
&gt; detail.<br>
&gt;<br>
&gt; xmlsectool.sh --verifySignature --certificate<br>
&gt; ./certs/my-signing-cert.pem --inFile<br>
&gt; /tmp/mda/federation/my-federation-metadata.xml<br>
&gt; INFO  XmlSecTool - Reading XML document from file<br>
&gt; &#39;/tmp/mda/federation/my-federation-metadata.xml&#39;<br>
&gt; INFO  XmlSecTool - XML document parsed and is well-formed.<br>
&gt; ERROR XmlSecTool - Unknown error<br>
&gt; java.lang.StringIndexOutOfBoundsException: String index out of range: -1<br>
&gt; at java.lang.String.substring(String.java:1937) ~[na:1.6.0_29]<br>
&gt; at java.lang.String.substring(String.java:1904) ~[na:1.6.0_29]<br>
&gt; at edu.internet2.middleware.security.XmlSecTool.validateSignatureReferenceUri(XmlSecTool.java:623)<br>
&gt; ~[xmlsectool-1.1.5.jar:na]<br>
&gt; at edu.internet2.middleware.security.XmlSecTool.validateSignatureReference(XmlSecTool.java:602)<br>
&gt; ~[xmlsectool-1.1.5.jar:na]<br>
&gt; at edu.internet2.middleware.security.XmlSecTool.verifySignature(XmlSecTool.java:554)<br>
&gt; ~[xmlsectool-1.1.5.jar:na]<br>
&gt; at edu.internet2.middleware.security.XmlSecTool.main(XmlSecTool.java:156)<br>
&gt; ~[xmlsectool-1.1.5.jar:na]<br>
&gt;<br>
&gt; Which led me to<br>
&gt; <a href="https://issues.shibboleth.net/jira/browse/XSTJ-15?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#issue-tabs" target="_blank">https://issues.shibboleth.net/jira/browse/XSTJ-15?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#issue-tabs</a><br>


&gt;<br>
&gt; Then I decided to add an XMLSignatureValidationStage to my MDA<br>
&gt; configuration to validate the signature after the MDA signed it, and I<br>
&gt; got the following error:<br>
&gt;<br>
&gt; mda.sh /tmp/mda/my-federation-config.xml validateSignature<br>
&gt; <a href="tel:2012-01-23%2019" value="+12012012319">2012-01-23 19</a>:39:46,391 - WARN<br>
&gt; [org.apache.xml.security.signature.Reference:-1] - Verification failed<br>
&gt; for URI &quot;&quot;<br>
&gt; <a href="tel:2012-01-23%2019" value="+12012012319">2012-01-23 19</a>:39:46,394 - WARN<br>
&gt; [org.apache.xml.security.signature.Reference:-1] - Expected Digest:<br>
&gt; I0I+qxu89yE2c6grAFkgO+IbgaEv9DIhCYiGe+JDA/Q=<br>
&gt; <a href="tel:2012-01-23%2019" value="+12012012319">2012-01-23 19</a>:39:46,395 - WARN<br>
&gt; [org.apache.xml.security.signature.Reference:-1] - Actual Digest:<br>
&gt; usLmjOJIFNbagPGDEVXW0C0fhwLEtZ8jt0FWWx0/VIA=<br>
&gt;<br>
&gt; As I test I manually added an ID (ID=MYM20120123T194212) to the<br>
&gt; EntitiesDescriptor that the MDA created using the<br>
&gt; EntitiesDescriptorAssemblerStage, then I used xmlsectool to sign the<br>
&gt; metadata using --referenceIdAttributeName ID.  Now I had no issues<br>
&gt; validating the signature.<br>
&gt;<br>
&gt; ./xmlsectool.sh --sign --referenceIdAttributeName ID --inFile<br>
&gt; /tmp/mda/federation/my-federation-metadata-unsigned.xml --key<br>
&gt; ../certs/my-signing-key.pem --certificate ../certs/my-signing-cert.pem<br>
&gt; --outFile /tmp/mda/federation/my-federation-metadata.xml<br>
&gt; INFO  XmlSecTool - Reading XML document from file<br>
&gt; &#39;/tmp/mda/federation/my-federation-metadata-unsigned.xml&#39;<br>
&gt; INFO  XmlSecTool - XML document parsed and is well-formed.<br>
&gt; INFO  XmlSecTool - XML document successfully signed<br>
&gt; INFO  XmlSecTool - XML document written to file<br>
&gt; /tmp/mda/federation/my-federation-metadata.xml<br>
&gt;<br>
&gt; ./xmlsectool.sh --verifySignature --signatureRequired --certificate<br>
&gt; ../certs/my-signing-cert.pem --inFile<br>
&gt; /tmp/mda/federation/my-federation-metadata.xml<br>
&gt; INFO  XmlSecTool - Reading XML document from file<br>
&gt; &#39;/tmp/mda/federation/my-federation-metadata.xml&#39;<br>
&gt; INFO  XmlSecTool - XML document parsed and is well-formed.<br>
&gt; INFO  XmlSecTool - XML document signature verified.<br>
&gt;<br>
&gt; I think I&#39;m on the right track...<br>
&gt;<br>
&gt; The signature that the MDA is adding isn&#39;t valid because the Reference<br>
&gt; URI for the Signature isn&#39;t getting set by my<br>
&gt; XMLSignatureSigningStage, the reason the Reference URI isn&#39;t getting<br>
&gt; set is because the EntitiesDescriptorAssemblerStage doesn&#39;t set the ID<br>
&gt; for the EntitiesDescriptor, the reason the ID isn&#39;t getting set for<br>
&gt; the EntitiesDescriptor is because I don&#39;t have a<br>
&gt; EntityDescriptorItemIdPopulationStage, and the reason I don&#39;t have an<br>
&gt; EntityDescriptorItemIdPopulationStage is because I used the examples<br>
&gt; to build my MDA configuration (which also don&#39;t use an<br>
&gt; EntityDescriptorItemIdPopulationStage), so I never realized until<br>
&gt; after several hours of debugging today that it was even necessary.<br>
&gt;<br>
&gt; Now for the difficult question...Does anyone have an example that<br>
&gt; shows how to properly define an EntityDescriptorItemIdPopulationStage<br>
&gt; so I can get an ID assigned to my EntitiesDescriptor?<br>
</div></div><div class="HOEnZb"><div class="h5">&gt; --<br>
&gt; To unsubscribe from this list send an email to <a href="mailto:dev-unsubscribe@shibboleth.net">dev-unsubscribe@shibboleth.net</a><br>
<br>
<br>
<br>
--<br>
Chad La Joie<br>
<a href="http://www.itumi.biz" target="_blank">www.itumi.biz</a><br>
trusted identities, delivered<br>
--<br>
To unsubscribe from this list send an email to <a href="mailto:dev-unsubscribe@shibboleth.net">dev-unsubscribe@shibboleth.net</a><br>
</div></div></blockquote></div><br>