# How FusionAuth Verifies SAML v2 Signatures

Learn how FusionAuth chooses the key that verifies the signature on a SAML response, and how certificate rotation works.

> For the index of this section of the site, see [llms.txt](https://fusionauth.io/docs/llms.txt)

FusionAuth verifies the signature on every SAML response from a SAML v2 Identity Provider. FusionAuth trusts only the keys in **Verification keys** on the Identity Provider. A certificate in [Key Master](https://fusionauth.io/docs/security/tokens-and-keys/key-master.md) that isn't in **Verification keys** can't verify a response.

## Key Selection

FusionAuth chooses the verification key as follows:

*   When the signature includes an [X.509](https://fusionauth.io/docs/security/tokens-and-keys/key-master.md) certificate in the `KeyInfo` element, FusionAuth computes the SHA-1 thumbprint of the certificate. FusionAuth then verifies the signature with the key in **Verification keys** whose certificate has the same thumbprint. The order of the keys doesn't matter. When no key matches, FusionAuth rejects the response.
*   When the signature doesn't include a certificate, FusionAuth verifies the signature with the default key. The default key is the key marked **Default** in the Admin UI, and the first key in **`verificationKeyIds`** in the API.

```mermaid
flowchart TD
    A[SAML response arrives] --> B{Does KeyInfo contain an X.509 certificate?}
    B -- Yes --> C{Does a certificate in Verification keys have the same SHA-1 thumbprint?}
    C -- Yes --> D[Verify the signature with the matching certificate]
    C -- No --> E[Reject the response]
    B -- No --> F[Verify the signature with the default key]
```

FusionAuth chooses the key that verifies the signature on a SAML response from an external Identity Provider.

Caution

A verification key that contains only a public key, without a certificate, never matches the certificate in `KeyInfo`. A public key can verify a response only as the default key, and only when the signature doesn't include a certificate. When the Identity Provider gives you a certificate, import the certificate.

When no key matches, the Event Log contains `Invalid SAML v2.0 operation. The signature is invalid.` For the steps to find the missing certificate, see [Troubleshooting](https://fusionauth.io/docs/authentication/identity-providers/overview-samlv2.md#troubleshooting).

## Certificate Rotation

Many Identity Providers publish more than one signing certificate in their metadata. The extra certificates let a service provider trust a new certificate before the Identity Provider starts to sign with the new certificate.

FusionAuth matches each response to a certificate by thumbprint, so **Verification keys** can hold the old and new certificates at the same time. Logins keep working while the Identity Provider switches certificates. Import each published certificate into Key Master, and add each certificate to **Verification keys**. Mark the certificate that the Identity Provider currently signs with as **Default**, for responses whose signature doesn't include a certificate. After the Identity Provider stops signing with the old certificate, remove the old certificate from **Verification keys**.

For more information, see [Key Master](https://fusionauth.io/docs/security/tokens-and-keys/key-master.md).

Related

[Authentication Add an External SAML v2 IdP Learn how to let users log in to FusionAuth through an external SAML v2 Identity Provider. samlsaml v2signing certificate](https://fusionauth.io/docs/authentication/identity-providers/overview-samlv2.md)

[Authentication Add a SAML v2 with Azure AD IdP Learn how to configure Azure AD (Microsoft Entra ID) as a SAML v2 Identity Provider for FusionAuth. saml v2signing certificatecertificate rotation](https://fusionauth.io/docs/authentication/identity-providers/enterprise/azure-ad-saml.md)

[Authentication SAML v2 Identity Provider Settings Reference for the form fields and Integration Details of the SAML v2 and SAML v2 IdP Initiated Identity Providers. samlsaml v2verification keys](https://fusionauth.io/docs/authentication/identity-providers/samlv2-settings.md)

[Authentication Add FusionAuth Login to an External Application Learn how to let users log in to a third-party application, such as a SaaS product, with their FusionAuth accounts over OpenID Connect or SAML v2. saml v2saml](https://fusionauth.io/docs/authentication/act-as-an-idp/add-login-to-external-app.md)
---

## Other pages in Identity Providers

> For the full index of this section, see [Authentication](https://fusionauth.io/docs/llms-authentication.txt).

- [Identity Providers, Applications, and Overrides](https://fusionauth.io/docs/authentication/identity-providers/applications-and-overrides.md): Learn how Identity Providers work with Applications, CIMD clients, and Application-specific overrides.
- [Attribute Mappings](https://fusionauth.io/docs/authentication/identity-providers/attribute-mappings.md): Learn how to map claims from an Identity Provider response to FusionAuth user and registration fields without a lambda.
- [Add a SAML v2 with ADFS IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/adfs.md): Configure SAML v2 for Active Directory Federation Services (ADFS).
- [Add an OpenID Connect with Azure AD IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/azure-ad-oidc.md): Set up user login using Azure AD/Microsoft Entra ID as an OpenID Connect Identity Provider.
- [Add a SAML v2 with Azure AD IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/azure-ad-saml.md): Learn how to configure Azure AD (Microsoft Entra ID) as a SAML v2 Identity Provider for FusionAuth.
- [Add a OpenID Connect with Cognito IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/cognito.md): Set up user login using Cognito as an OpenID Connect Identity Provider.
- [Add a HYPR IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/hypr.md): Set up user login with HYPR using the HYPR Identity Provider.
- [Add an OpenID Connect with Okta IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/okta-oidc.md): Learn how to set up user login using Okta as an OpenID Connect Identity Provider.
- [Add SAML v2 IdP-Initiated Login With Okta](https://fusionauth.io/docs/authentication/identity-providers/enterprise/okta-samlv2-idp-initiated.md): Learn how to let users log in to FusionAuth from the Okta dashboard with SAML v2 IdP-initiated login.
- [Add a SAML v2 with Okta IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/okta-samlv2.md): Configure SAML v2 for Okta.
- [Add a SAML v2 IdP-Initiated IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/samlv2-idp-initiated.md): Learn how to let users log in to FusionAuth from a dashboard in a SAML v2 Identity Provider that supports only IdP-initiated login.
- [External JWT IdP Example Usage](https://fusionauth.io/docs/authentication/identity-providers/external-jwt/example.md): Learn how to federate identity using the External JWT Identity Provider.
- [Add an External JWT IdP](https://fusionauth.io/docs/authentication/identity-providers/external-jwt.md): Learn how to configure an External JWT Identity Provider so FusionAuth can log in users with JWTs from a third-party identity provider.
- [Add an OpenID Connect with Discord IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/discord.md): Learn how to add a Login with Discord button to the FusionAuth login pages with the OpenID Connect Identity Provider.
- [Add an Epic Games IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/epic-games.md): Learn how to add an Epic Games login button to the FusionAuth login pages.
- [Add a Nintendo IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/nintendo.md): Learn how to add a Nintendo login button to the FusionAuth login pages.
- [Add a Sony PlayStation Network IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/sony.md): Learn how to add a Sony PlayStation Network login button to the FusionAuth login pages.
- [Add a Steam IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/steam.md): Learn how to add a Steam login button to the FusionAuth login pages.
- [Add a Twitch IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/twitch.md): Learn how to add a Twitch login button to the FusionAuth login pages.
- [Add an Xbox IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/xbox.md): Learn how to add an Xbox login button to the FusionAuth login pages.
- [Identity Provider Hints](https://fusionauth.io/docs/authentication/identity-providers/hints.md): Learn how to send users from the hosted login pages straight to an Identity Provider with the idp_hint and login_hint parameters.
- [Identity Provider Scope](https://fusionauth.io/docs/authentication/identity-providers/identity-provider-scope.md): Learn about global and tenant-scoped Identity Providers, and how to limit the links that each user can have to an Identity Provider.
- [Add an Identity Provider (IdP)](https://fusionauth.io/docs/authentication/identity-providers.md): Learn how to let users log in through an external identity provider such as Google or Okta.
- [Linking Strategies](https://fusionauth.io/docs/authentication/identity-providers/linking-strategies.md): Learn how FusionAuth links a user from an Identity Provider to a FusionAuth user.
- [Managed Domains](https://fusionauth.io/docs/authentication/identity-providers/managed-domains.md): Learn how managed domains connect email domains to an Identity Provider.
- [Add an OpenID Connect IdP](https://fusionauth.io/docs/authentication/identity-providers/overview-oidc.md): Learn how to let users log in to FusionAuth through an external OpenID Connect Identity Provider.
- [Add an External SAML v2 IdP](https://fusionauth.io/docs/authentication/identity-providers/overview-samlv2.md): Learn how to let users log in to FusionAuth through an external SAML v2 Identity Provider.
- [How SAML v2 IdP-Initiated Login Works](https://fusionauth.io/docs/authentication/identity-providers/samlv2-idp-initiated-login.md): Learn how FusionAuth handles a SAML v2 IdP-initiated login, and how FusionAuth chooses the redirect URI and scope.
- [SAML v2 Identity Provider Settings](https://fusionauth.io/docs/authentication/identity-providers/samlv2-settings.md): Reference for the form fields and Integration Details of the SAML v2 and SAML v2 IdP Initiated Identity Providers.
- [Add an Apple IdP](https://fusionauth.io/docs/authentication/identity-providers/social/apple.md): Learn how to add a Sign in with Apple button to your application.
- [Add a Facebook IdP](https://fusionauth.io/docs/authentication/identity-providers/social/facebook.md): Learn how to add a Login with Facebook button to your application.
- [Add a Github IdP](https://fusionauth.io/docs/authentication/identity-providers/social/github.md): Set up user login using Github as an OpenID Connect Identity Provider.
- [Add a Google IdP](https://fusionauth.io/docs/authentication/identity-providers/social/google.md): Learn how to add a Login with Google button to your application.
- [Add a LinkedIn IdP](https://fusionauth.io/docs/authentication/identity-providers/social/linkedin.md): Learn how to add a Sign in with LinkedIn button to your application.
- [Add a Twitter/X IdP](https://fusionauth.io/docs/authentication/identity-providers/social/twitter.md): Learn how to add a Login with Twitter/X button to your application.
