Skip to content

Clean up CompositeMLDsaAlgorithm and add comprehensive tests #117135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 30, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 29, 2025

This PR addresses the cleanup and testing requirements for CompositeMLDsaAlgorithm as requested in the issue.

Changes Made

1. Documentation Fix

  • Fixed typo in CompositeMLDsaAlgorithm.cs line 21: "An a string" → "A string"

2. Comprehensive Test Suite

Added CompositeMLDsaAlgorithmTests.cs with tests covering:

  • Algorithm parameter validation: Verifies correct names and signature sizes for all 18 composite algorithm variants
  • Reference equality: Tests that static properties return the same instances
  • Equality/inequality operators: Validates == and != operator behavior
  • Hash codes: Ensures consistent GetHashCode() implementation
  • String representation: Tests ToString() method
  • Null handling: Validates Equals() method with null inputs

3. Test Coverage

The test suite comprehensively covers all 18 CompositeMLDsaAlgorithm variants:

ML-DSA-44 (4 variants):

  • MLDsa44WithRSA2048Pss
  • MLDsa44WithRSA2048Pkcs15
  • MLDsa44WithEd25519
  • MLDsa44WithECDsaP256

ML-DSA-65 (8 variants):

  • MLDsa65WithRSA3072Pss/Pkcs15
  • MLDsa65WithRSA4096Pss/Pkcs15
  • MLDsa65WithECDsaP256/P384/BrainpoolP256r1
  • MLDsa65WithEd25519

ML-DSA-87 (6 variants):

  • MLDsa87WithECDsaP384/BrainpoolP384r1/P521
  • MLDsa87WithEd448
  • MLDsa87WithRSA3072Pss/RSA4096Pss

4. Integration

  • Added tests to both System.Security.Cryptography.Tests.csproj and Microsoft.Bcl.Cryptography.Tests.csproj
  • Follows existing patterns from SlhDsaAlgorithmTests and MLDsaAlgorithmTests
  • Uses standard xUnit patterns with [Theory], [MemberData], and AssertExtensions

All changes are minimal and surgical, maintaining compatibility while providing comprehensive test coverage for the CompositeMLDsaAlgorithm class.

Fixes #117134.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://www.microsoft.com:80/pki/certs/MicCodSigPCA_08-31-2010.crt
    • Triggering command: /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net10.0-linux-Debug-x64/dotnet exec --runtimeconfig System.Security.Cryptography.Tests.runtimeconfig.json --depsfile System.Security.Cryptography.Tests.deps.json /home/REDACTED/.nuget/packages/microsoft.dotnet.xunitconsoleREDACTED/2.9.2-beta.25311.107/build/../tools/net/xunit.console.dll System.Security.Cryptography.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing (http block)
  • http://www.microsoft.com:80/pki/mscorp/Microsoft%20RSA%20TLS%20CA%2001.crt
    • Triggering command: /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net10.0-linux-Debug-x64/dotnet exec --runtimeconfig System.Security.Cryptography.Tests.runtimeconfig.json --depsfile System.Security.Cryptography.Tests.deps.json /home/REDACTED/.nuget/packages/microsoft.dotnet.xunitconsoleREDACTED/2.9.2-beta.25311.107/build/../tools/net/xunit.console.dll System.Security.Cryptography.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing (http block)
    • Triggering command: /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net10.0-linux-Debug-x64/dotnet exec --runtimeconfig /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.deps.json /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/testhost.dll --port 35095 --endpoint 127.0.0.1:035095 --role client --parentprocessid 73784 --datacollectionport 32835 --telemetryoptedin false (http block)
    • Triggering command: /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net10.0-linux-Debug-x64/dotnet exec --runtimeconfig /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.deps.json /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/testhost.dll --port 41119 --endpoint 127.0.0.1:041119 --role client --parentprocessid 73986 --datacollectionport 33619 --telemetryoptedin false (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: PranavSenthilnathan <12225508+PranavSenthilnathan@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Clean up CompositeMLDsaAlgorithm and add tests Clean up CompositeMLDsaAlgorithm and add comprehensive tests Jun 29, 2025
@Copilot Copilot AI requested a review from PranavSenthilnathan June 29, 2025 21:35
Copilot finished work on behalf of PranavSenthilnathan June 29, 2025 21:35
Co-authored-by: PranavSenthilnathan <12225508+PranavSenthilnathan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jun 29, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://www.microsoft.com:80/pki/mscorp/Microsoft%20RSA%20TLS%20CA%2001.crt
    • Triggering command: /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net10.0-linux-Debug-x64/dotnet exec --runtimeconfig /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.deps.json /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/testhost.dll --port 38729 --endpoint 127.0.0.1:038729 --role client --parentprocessid 36858 --datacollectionport 44825 --telemetryoptedin false (http block)
    • Triggering command: /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net10.0-linux-Debug-x64/dotnet exec --runtimeconfig /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/System.Security.Cryptography.Tests.deps.json /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Security.Cryptography.Tests/Debug/net10.0-unix/testhost.dll --port 37153 --endpoint 127.0.0.1:037153 --role client --parentprocessid 37064 --datacollectionport 43147 --telemetryoptedin false (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI requested a review from PranavSenthilnathan June 29, 2025 22:30
Copilot finished work on behalf of PranavSenthilnathan June 29, 2025 22:30
@PranavSenthilnathan PranavSenthilnathan marked this pull request as ready for review June 29, 2025 22:57
@PranavSenthilnathan PranavSenthilnathan added this to the 10.0.0 milestone Jun 29, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

@PranavSenthilnathan PranavSenthilnathan merged commit c02569b into main Jun 30, 2025
82 of 88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up CompositeMLDsaAlgorithm and add tests
3 participants