<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 6/3/15 11:28 AM, Richard Mundell
      wrote:<br>
    </div>
    <blockquote
cite="mid:BN3PR0601MB12995C5C7435B774481AE2C5E8B40@BN3PR0601MB1299.namprd06.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Tahoma","sans-serif";
        font-variant:normal !important;
        color:windowtext;
        text-transform:none;
        text-decoration:none none;
        vertical-align:baseline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Tahoma","sans-serif";
        font-variant:normal !important;
        color:black;
        text-transform:none;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;
        vertical-align:baseline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p></o:p></span>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">The
            code is here:
            <a moz-do-not-send="true"
              href="http://pastebin.com/vkNVGEXW">http://pastebin.com/vkNVGEXW</a>
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
        <span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p></o:p></span>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">2)
            unmarshalls the assertion response from a String into an
            OpenSAML Assertion object<o:p></o:p></span></p>
        <span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p></o:p></span></div>
    </blockquote>
    <br>
    The Assertion string you have there looks suspciously
    indented/pretty-printed...  I don't think TestShib generates
    Assertions formatted like that.  And since you're pulling it in as a
    string, and having to escape things, etc, almost certainly there's
    some error in there, such that it's not the same XML that was
    signed.<br>
    <br>
    <blockquote
cite="mid:BN3PR0601MB12995C5C7435B774481AE2C5E8B40@BN3PR0601MB1299.namprd06.prod.outlook.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Unfortunately
            this final step doesn't work and I get a “Invalid signature
            due to this error: Signature did not validate against the
            credential's key” exception.</span></p>
      </div>
    </blockquote>
    <br>
    Assuming you're sure you have the right validation key, I'd wager
    with 99.9% certainty that you have corrupted the Assertion by
    modifying it from what was signed.  Adding/removing even a single
    character of whitespace will invalidate the signature.<br>
    <br>
    In case you haven't found yet:<br>
    <br>
<a class="moz-txt-link-freetext" href="https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManJavaDSIG">https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManJavaDSIG</a><br>
    <br>
    and in particular:<br>
    <br>
<a class="moz-txt-link-freetext" href="https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManSigErrors">https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManSigErrors</a><br>
    <br>
    <br>
  </body>
</html>