Skip to content

Don't throw in NegotiateClientCertificateAsync if Post-Handshake auth wasn't enabled. - #128942

Merged
rzikm merged 5 commits into
dotnet:mainfrom
rzikm:tls-pha-error
Jun 10, 2026
Merged

rzikm merged 5 commits into
dotnet:mainfrom
rzikm:tls-pha-error

Conversation

@rzikm

@rzikm rzikm commented Jun 3, 2026

Copy link
Copy Markdown
Member

Small change to avoid a cryptic exception in a corner case where client does not offer any client certificates.

Copilot AI review requested due to automatic review settings June 3, 2026 11:44
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
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 adjusts the Unix/OpenSSL renegotiation / TLS 1.3 post-handshake-auth (PHA) path so SslStream.NegotiateClientCertificateAsync can gracefully no-op (instead of throwing) when the peer didn’t enable/offer PHA, and adds a Linux/TLS 1.3 functional regression test for that scenario.

Changes:

  • Populate the OpenSSL error code on TLS 1.3 PHA initiation failures (native) and propagate renegotiation status back to SslStream (managed).
  • Map OpenSSL renegotiation failures to a status that SslStream can interpret as “no renegotiation / keep session usable”.
  • Add a Linux TLS 1.3 functional test for NegotiateClientCertificateAsync when PHA isn’t offered.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/native/libs/System.Security.Cryptography.Native/pal_ssl.c Improves TLS 1.3 PHA initiation error reporting from OpenSSL in the renegotiation entrypoint.
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs Changes how OpenSSL renegotiation failures are surfaced to managed code.
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs Ensures renegotiation failures return a ProtocolToken carrying the status (instead of default).
src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs Adds coverage for NegotiateClientCertificateAsync when TLS 1.3 PHA isn’t offered (Linux/OpenSSL).

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings June 3, 2026 12:32

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings June 3, 2026 12:58

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings June 4, 2026 06:14

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

@rzikm
rzikm merged commit 9e2858a into dotnet:main Jun 10, 2026
116 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 17, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
… wasn't enabled. (#128942)

Small change to avoid a cryptic exception in a corner case where client
does not offer any client certificates.

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants