XML signature validation
Brent Putman
putmanb at georgetown.edu
Mon Dec 15 13:38:35 EST 2014
On 12/15/14 1:22 PM, Sandy wrote:
>
>
> 1. Is it a good practice to use the public key from the SAML assertion?
That's a complicated question. The short answer is, you can literally
extract the key from the Signature's KeyInfo and cryptographically
verify the signature with it - but you can't *only* do that. One way or
another, you have to verify the trust of the key using out-of-band
information, such as SAML metadata.
> 2. If yes, are there any existing utility methods - that I'm unaware
> of - to create or validate the signature without having to append and
> pre-pend the markers.
Yes, there are lots of ways to build the cert from the base64-encoded
DER without the PEM headers/footers. Those are not really part of the
encoding. You didn't say what your SP is built with, but if it's
OpenSAML Java (or I assume also C++) then we have helpers in xmltooling
for that purposes. But we also have higher level components, for
example which resolve a Credential from a KeyInfo, or which wrap that in
the entire trust-establishment process (TrustEngine).
> 3. Why are the markers stripped off from the x509certificate in
> idp-metadata.xml.
They're not specified nor allowed by the spec which defines the KeyInfo
structure (the XML Signature specification).
The headers/footers that you're calling "markers" are from PEM format,
used on disk, in MIME email, etc. The use case here doesn't specify
that format.
>
> For the record, I have followed
>
> https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManJavaDSIG
>
>
> page, which was helpful, but the method call
> 'getVerificationCredential()' was not clear, which is what I was
> trying to implement.
>
Ok. It's deliberately left unclear, b/c it's just a sketch of the API.
You typically wouldn't want to actually do that in the real world, at
least not *just* that. Note the big red box above about "Trust
Establishment", don't ignore that.
The more complex example below that with the TrustEngine is conceptually
what you really have to do. There's layers of abstraction in there,
but ultimately you have to verify the trust of the signing key or else
you have zero security. You can't just trust what is in the Signature's
KeyInfo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20141215/72e07843/attachment.html
More information about the dev
mailing list