-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Cleanup for cert accessors #118116
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
Cleanup for cert accessors #118116
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 performs cleanup for certificate accessor methods following a previous change. The main purpose is to optimize memory usage by replacing byte array allocations with pooled memory for public key comparisons, standardize platform checks, and add proper argument validation with consistent documentation.
Key changes:
- Replace byte array allocations with
CryptoPoolLeasefor improved memory management in key comparison operations - Consolidate platform detection logic into a centralized
Helpers.IsOSPlatformWindowsproperty - Add comprehensive argument validation and XML documentation to public API methods
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| X509Certificate2.cs | Replace byte array allocations with pooled memory for ML-KEM, ML-DSA, and SLH-DSA key comparisons |
| CertificatePal.Windows.PrivateKey.cs | Remove extra blank line for code formatting consistency |
| PrivateKeyAssociationTests.cs | Add comprehensive argument validation tests for post-quantum cryptography methods |
| X509CertificateKeyAccessors.cs | Add argument validation, XML documentation, and replace allocations with pooled memory |
| MLKemImplementation.Windows.cs | Consolidate platform checks using centralized helper and remove unused imports |
| MLKemCng.cs | Consolidate platform checks using centralized helper and remove unused imports |
| MLDsaImplementation.Windows.cs | Consolidate platform checks using centralized helper and remove unused imports |
| MLDsaCng.cs | Consolidate platform checks using centralized helper and remove unused imports |
| Helpers.cs | Add centralized IsOSPlatformWindows property for consistent platform detection |
| CompositeMLDsaImplementation.Windows.cs | Consolidate platform checks using centralized helper and remove unused imports |
| Interop.Properties.cs | Update platform check to use centralized helper and remove unused imports |
...ryptography/src/System/Security/Cryptography/X509Certificates/X509CertificateKeyAccessors.cs
Outdated
Show resolved
Hide resolved
...ryptography/src/System/Security/Cryptography/X509Certificates/X509CertificateKeyAccessors.cs
Outdated
Show resolved
Hide resolved
4b9abef to
a21c4b2
Compare
Follow-up to #117907
Fixes #118066