ใ‚†ใ‚‹ใƒ†ใƒƒใ‚ฏใƒŽใƒผใƒˆ

SAML Signature Basics

SAML Responses are protected with XML Signatures. This page covers how signatures are structured, what to check when verifying them, and how to run certificate operations safely.

๐Ÿ” Signature Structure

Signatures live under ds:Signature and may target the Assertion or the entire Response. Verification uses the IdP-provided X.509 certificate.

Core elements

  • ๐Ÿ“Œ The target can be the Assertion or the full Response (sometimes both).
  • ๐Ÿ“Œ Signature is stored in ds:Signature and verified with an X.509 certificate.
  • ๐Ÿ“Œ A wrong Reference URI (scope) causes verification to fail.

๐Ÿ›ก๏ธ Verification Tips

Check not only the signature itself but also the conditions and certificate state.

Common checks

  • โœ… Time drift causes NotBefore / NotOnOrAfter failures.
  • โœ… Audience must match the expected EntityID.
  • โœ… Ensure the signature covers the expected element (Assertion/Response).
  • โœ… Watch for expired or malformed certificates.

Certificate operations

  • ๐Ÿ” Track rotation schedules and update metadata in advance.
  • ๐Ÿ” Use CRL/OCSP if provided to check revocation.
  • ๐Ÿ” If key pinning is used, deploy new keys in the right order to avoid lockouts.
  • ๐Ÿ” Keep test and production certificates separate to avoid mix-ups.

๐Ÿงฏ Common Errors and Fixes

Signature failures have recurring patterns; knowing them speeds up troubleshooting.

Typical cases

  • โš ๏ธ Signature verification errors: wrong certificate, wrong reference, possible tampering.
  • โš ๏ธ XML parsing errors: Deflate/Base64 decoding failures.
  • โš ๏ธ Condition mismatch: time drift or audience mismatch.

How to troubleshoot

  • ๐Ÿงญ Check the Reference URI and certificate fingerprint shown in logs.
  • ๐Ÿงญ Verify NTP/timezone to rule out clock skew.
  • ๐Ÿงญ Re-import IdP/SP metadata to eliminate mismatches.

SubjectConfirmation / Conditions checks

SubjectConfirmation (especially Bearer) and Conditions must be validated; mismatches mean the assertion is not intended for the recipient.

  • SubjectConfirmationData Recipient matches the ACS URL.
  • NotBefore/NotOnOrAfter are within the current time window.
  • Conditions > AudienceRestriction matches the expected EntityID.