opyeb samlview

samlview · Validation

Reading a SAML XML signature's structure

Signature placement, enveloped signature, C14N, Reference URI, SHA-1, embedded X.509

Trust in a SAML response starts with the XML signature. But 'signed' and 'valid' are different statements. This article is not about verifying a signature; it is about reading the signature element's structure to see what was signed.

A signature can sit in two places

Which one is signed decides what the SP verifies and with which key. Check the placement first when reading a log.

Structure of an enveloped signature

ds:Signature → SignedInfo → (CanonicalizationMethod, SignatureMethod, Reference* → (Transforms, DigestMethod, DigestValue)), SignatureValue, KeyInfo
ElementWhat to checkCommon problem
CanonicalizationMethodwhether exc-c14n is usedsigner and verifier disagree on C14N
SignatureMethodrsa-sha256, ecdsa-sha256 and so onrsa-sha1 in use
DigestMethodsha256, sha384sha1
Reference/@URIwhether #ID matches the signed targetconfusing #_abc with #abc
Transformsenveloped-signature and exc-c14n presentmissing transform

What the Reference URI points at

The URI of Reference points at the ID of the signed element. In SAML it is # followed by the Response or Assertion ID. If it does not match the actual ID, verification fails with 'target not found'. A related failure is an XML parser that does not treat the ID attribute as an ID type.

This tool compares the Reference URI with the actual ID as a string and reports a match. It does not check ID-type declarations or schema validation.

SHA-1 and weak algorithms

Since the 2010s most SAML implementations use rsa-sha256. A leftover rsa-sha1 signature points to an old IdP configuration or a compatibility option. It carries a real risk of signature forgery and should be moved to SHA-256 or stronger where possible. samlview marks a SHA-1 SignatureMethod or DigestMethod as a warning.

The embedded X.509 certificate

KeyInfo/ds:X509Certificate holds the signing certificate in Base64. This tool decodes the DER and shows the subject, issuer, validity and serial number. It does not check whether that certificate matches the one in the IdP metadata or whether the chain is trusted; that belongs to the SP's validation.

In short, a structure check tells you quickly what was signed, and cryptographic verification decides whether the signature is correct. Confusing the two lets expired keys or wrong References slip through.

Frequently asked questions

Is a signature always safe?

No. If it targets the wrong element, uses a weak algorithm or a certificate nobody trusts, it means little. Look at both structure and verification.

What if the Reference URI has no #?

In XML Signature a same-document identifier uses #. Without it the value may be read as an external URI, which deserves attention.

Does this tool verify the signature?

No. It inspects structure. Verification belongs to the SP's SAML library or a dedicated verifier.

Load the SHA-1 sample and see which warnings appear.

Open the tool

This article follows OASIS SAML 2.0 Core (2005), SAML 2.0 Bindings, SAML 2.0 Profiles, XML Signature 1.1 and RFC 1951 (DEFLATE). Every example is synthetic data.