Implement support for loading multiple providers into a single context#129477
Open
vcsjones wants to merge 9 commits into
Open
Implement support for loading multiple providers into a single context#129477vcsjones wants to merge 9 commits into
vcsjones wants to merge 9 commits into
Conversation
Contributor
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the OpenSSL provider key-loading path to support loading multiple OpenSSL 3 providers into a single OSSL_LIB_CTX, and exposes a new managed overload that accepts a provider list plus an optional OpenSSL property query passed to OSSL_STORE_open_ex.
Changes:
- Add
SafeEvpPKeyHandle.OpenKeyFromProvider(IEnumerable<string> providerNames, string keyUri, string? propertyQuery = null)and update the native interop to accept multiple provider names. - Update native provider loading to load all requested providers into one library context and pass
propertyQuerythrough toOSSL_STORE_open_ex. - Expand manual tests to cover new overload argument validation and property query scenarios.
Show a summary per file
| File | Description |
|---|---|
| src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.h | Update native API contract to accept multiple providers + property query. |
| src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c | Implement multi-provider loading/unload-on-partial-failure; pass property query to OSSL_STORE_open_ex. |
| src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs | Update P/Invoke signature and managed interop wrapper for the new native contract. |
| src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SafeEvpPKeyHandle.OpenSsl.cs | Add new public overload, argument validation, provider-set caching keying, and wire to updated interop. |
| src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSsl.NotSupported.cs | Add the new overload stub for unsupported platforms. |
| src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs | Add the new public API surface to the reference assembly. |
| src/libraries/System.Security.Cryptography/src/Resources/Strings.resx | Add a new resource string for empty-collection validation. |
| src/libraries/System.Security.Cryptography/tests/OpenSslNamedKeysTests.manual.cs | Add/adjust manual tests for the new overload and property query behavior. |
Copilot's findings
- Files reviewed: 8/8 changed files
- Comments generated: 3
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
bartonjs
reviewed
Jun 16, 2026
bartonjs
reviewed
Jun 16, 2026
bartonjs
approved these changes
Jun 17, 2026
Open
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #113118