-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Change Key on MLDsaCng to GetKey method #117741
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
Conversation
There was a problem hiding this 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 changes the Key
property in the MLDsaCng
class to a GetKey()
method that returns a duplicated CNG key handle, following the same pattern previously implemented for MLKemCng
. The change improves resource management by ensuring callers receive their own handle copy instead of sharing the internal handle.
Key changes:
- Property-to-method conversion for better handle management
- Addition of internal
KeyNoDuplicate
property for internal use - Test coverage for the new
GetKey()
method behavior
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
MLDsaCng.cs |
Updates API documentation and signature from property to method |
MLDsaCng.Windows.cs |
Implements GetKey() method with handle duplication logic and adds internal KeyNoDuplicate property |
Cng.NotSupported.cs |
Updates not-supported implementation and improves error message consistency |
System.Security.Cryptography.cs |
Updates public API reference from property to method |
CertificatePal.Windows.PrivateKey.cs |
Updates callers to use internal KeyNoDuplicate property |
MLDsaCngTests.Windows.cs |
Adds test to verify GetKey() returns distinct duplicated handles |
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
As we did for MLKemCng, this changes the
CngKey Key
property toCngKey GetKey()
method that returns a duplicated handle.