Skip to content

add more valid algorithms - #71

Open
Kattemat wants to merge 4 commits into
mainfrom
fix-valid-algorithms
Open

Kattemat wants to merge 4 commits into
mainfrom
fix-valid-algorithms

Conversation

@Kattemat

@Kattemat Kattemat commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Legger til flre valide algoritmer (PSA er feks brukt av helseid)

@jennyhougen jennyhougen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Kattemat
Kattemat requested a review from jennyhougen June 15, 2026 12:55

@jennyhougen jennyhougen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lag tester. Jeg sender noen eksempler.

@Kattemat

Copy link
Copy Markdown
Contributor Author

Lag tester. Jeg sender noen eksempler.

Hva slags tester føler du mangler?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 expands the default set of accepted DPoP alg values (notably adding RSA-PSS variants) and updates the test infrastructure + integration tests to exercise the newly-allowed algorithms.

Changes:

  • Extend DPoPProofTokenValidationParameters.ValidAlgorithms to include RSASSA-PSS with SHA-384 and SHA-512.
  • Refactor the test token/proof builder to support switching between RSA and EC key material.
  • Add integration tests that verify successful authentication for the default RSA/RSA-PSS and EC algorithms.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
tests/Fhi.Authentication.JwtDPoP.Tests/Setup/FakeDPoPTokenBuilder.cs Refactors the fake key/token builder to support RSA + EC keys and additional proof creation helpers.
tests/Fhi.Authentication.JwtDPoP.Tests/DPoPAuthenticationTests.cs Adds algorithm-matrix tests for RSA/RSA-PSS and EC algorithms.
src/Fhi.Authentication.JwtDPoP/Configurations/DPoPProofTokenValidationParameters.cs Expands the default allowed algorithm list to include additional RSA-PSS algorithms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

string alg = SecurityAlgorithms.RsaSha256)
{
var signingCredentials = new SigningCredentials(_rsaKey, alg);
var signingCredentials = new SigningCredentials(_keyPair.PrivateKey, alg);
string alg = SecurityAlgorithms.RsaSha256)
{
signingCredentials ??= new SigningCredentials(_rsaKey, alg);
signingCredentials ??= new SigningCredentials(_keyPair.PrivateKey, alg);
Comment on lines +229 to +238
var p = ecKey.ECDsa.ExportParameters(true);

var jwkWithPrivate = new Dictionary<string, string>
{
["kty"] = "EC",
["crv"] = ecKey.ECDsa.ExportParameters(false).Curve.Oid.FriendlyName!,
["x"] = Base64UrlEncoder.Encode(p.Q.X!),
["y"] = Base64UrlEncoder.Encode(p.Q.Y!),
["d"] = Base64UrlEncoder.Encode(p.D!)
};
Comment on lines +286 to +296
// Ensure this matches actual list
private static readonly string[] RsaAndPssAlgorithms =
{
SecurityAlgorithms.RsaSha256,
SecurityAlgorithms.RsaSha384,
SecurityAlgorithms.RsaSha512,
SecurityAlgorithms.RsaSsaPssSha256,
SecurityAlgorithms.RsaSsaPssSha384,
SecurityAlgorithms.RsaSsaPssSha512
};

Comment on lines +297 to +299
/// <summary>
/// Tests that default RSA algorithms works as aspected
/// </summary>
Comment on lines +334 to +336
/// <summary>
/// Tests that default EC algorithms works as aspected
/// </summary>

This branch has not been deployed

No deployments
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