Skip to content

Added code to have support for multiple SAML response encryption algorithms.#253

Open
ebsi-pjoshi wants to merge 2 commits into
ITfoxtec:mainfrom
ebsi-pjoshi:features/encryption-algorithms
Open

Added code to have support for multiple SAML response encryption algorithms.#253
ebsi-pjoshi wants to merge 2 commits into
ITfoxtec:mainfrom
ebsi-pjoshi:features/encryption-algorithms

Conversation

@ebsi-pjoshi
Copy link
Copy Markdown

No description provided.

@ebsi-ssundar
Copy link
Copy Markdown

@Revsgaard please review

@Revsgaard Revsgaard requested a review from Copilot September 15, 2025 08:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for multiple SAML response encryption algorithms by introducing new encryption algorithm constants, validation logic, and configuration options. The changes allow users to specify different encryption algorithms instead of being limited to the hardcoded AES256.

  • Added comprehensive set of encryption algorithm constants for various AES modes and key sizes
  • Introduced encryption algorithm validation with specific error handling for unsupported algorithms
  • Updated the encryption process to use configurable algorithms instead of hardcoded AES256

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Saml2EncryptionAlgorithms.cs New file defining encryption algorithm URL constants for AES, RSA, and SHA variants
Saml2AuthnResponse.cs Added encryption algorithm property and validation call during message encryption
Saml2EncryptedXml.cs Modified encryption method to accept algorithm parameter and set appropriate key sizes
EncryptionAlgorithm.cs New validation class that checks algorithm support and throws specific errors
Saml2Configuration.cs Added EncryptionAlgorithm property with AES256 as default

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/ITfoxtec.Identity.Saml2/Cryptography/Saml2EncryptedXml.cs Outdated
Comment on lines +36 to +43
else if (encryptionAlgorithm.Equals(Saml2EncryptionAlgorithms.XmlEncSHA256Url, StringComparison.InvariantCulture))
{
return;
}
else if (encryptionAlgorithm.Equals(Saml2EncryptionAlgorithms.XmlEncSHA512Url, StringComparison.InvariantCulture))
{
return;
}
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation allows SHA256 and SHA512 algorithms to pass as valid encryption methods, but these are message digest algorithms, not encryption algorithms. They should not be accepted for SAML assertion encryption.

Suggested change
else if (encryptionAlgorithm.Equals(Saml2EncryptionAlgorithms.XmlEncSHA256Url, StringComparison.InvariantCulture))
{
return;
}
else if (encryptionAlgorithm.Equals(Saml2EncryptionAlgorithms.XmlEncSHA512Url, StringComparison.InvariantCulture))
{
return;
}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

@ebsi-pjoshi ebsi-pjoshi Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Revsgaard Done with these changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants