Skip to content

Implement support for loading multiple providers into a single context#129477

Open
vcsjones wants to merge 9 commits into
dotnet:mainfrom
vcsjones:ossl-impl-multiprovider
Open

Implement support for loading multiple providers into a single context#129477
vcsjones wants to merge 9 commits into
dotnet:mainfrom
vcsjones:ossl-impl-multiprovider

Conversation

@vcsjones

Copy link
Copy Markdown
Member

Closes #113118

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

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 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 propertyQuery through to OSSL_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>
Copilot AI review requested due to automatic review settings June 16, 2026 20:40

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.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 4

Comment thread src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.h
Copilot AI review requested due to automatic review settings June 16, 2026 21:11

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.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 16, 2026 21:22

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.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Comment thread src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.h
Copilot AI review requested due to automatic review settings June 16, 2026 23:56

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.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Comment thread src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c
Copilot AI review requested due to automatic review settings June 17, 2026 00:10

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.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 0 new

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.

[API Proposal]: Flexible OpenSSL provider support

4 participants