they say the whole point is I need to do whatever it is I need to do with it?! with my own key - presumably my private key - in order to validate the signature.

That doesn't sound right to me. The way PKI works in general is that you verify a signature against the public key of the signer and that is, as you hinted, the certificate (which is in essence a public key) which is transmitted as part of the SAML assertion. You should not have sent the signer your public key for them to use in signing because it will be useless to them. The signer signs with their private key and the recipient validates it with the signer's public key.

Top tip number 1: use the XML::Sig that comes with Net::SAML2. It is in better shape than the standalone version on CPAN.

Top tip number 2: check everything as you go along in your script and add debugging statements at every turn: extracting the cert, extracting the sig, extracting the signed data, validating that the cert is the one you are expecting, validating the sig, etc. It's very easy to get confused with all this so the more debugging you have the better.

I've wrestled with this kind of thing several times and it seems that every implementation of SAML is subtly different so be prepared to massage the XML into some sort of standard form.

Good luck.


In reply to Re: Validating XML Signatures / SSL Certificate question (using Net::SAML) by hippo
in thread Validating XML Signatures / SSL Certificate question (using Net::SAML) by MattP

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.