Skip to content

[Android] Fix SslStream handshake connection info queries on older Android versions - #136517

Open
simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-android-tls-handshake
Open

simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-android-tls-handshake

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Summary

Avoid querying negotiated connection information from Android's handshake session during certificate validation when the platform cannot supply a valid cipher:

  • Defer the early query on API 24/25 ((NONE)), API 27 (native null-cipher crash), and API 28 (SSL_NULL_WITH_NULL_NULL).
  • Preserve working callback-time information on API 26 and API 29+, along with the existing protocol/context guards and handshake-completion refresh.
  • Keep the version predicate in SslStream.Android.cs, with an Android-only call from shared code. Expand the existing root-trust regression across protocols and client/server validation roles, checking callback metadata, final connection information, and bidirectional encrypted data.

Certificate-validation timing and policy are unchanged. This PR contains only the connection-info query fix; separate rejection/exception-handling hangs discovered during testing are not addressed here.

Validation

All results below are from the isolated patch in this PR, without the separate rejection-handling changes.

  • System.Net.Security product target frameworks: built successfully, zero warnings/errors.
  • Android ARM64, every API 24–37, CoreCLR and Mono: 148/148 focused regression cases passed. Covers TLS 1.2, OS-default negotiation, and TLS 1.3 where available, with both certificate-validation roles.
  • Complete AndroidPlatformTrust suite on API 28: 21/21 passed on each runtime.
  • macOS ARM64 FunctionalTests: 5,048 passed, 31 existing skips. UnitTests: 131 passed, 3 existing skips.
  • Frozen APKs were checked for the exact built System.Net.Security assembly, matching runtime CoreLib, and correct native runtime host; test XML counts and protocol/role combinations were independently verified.

Full-suite execution on every Android API and other architectures was not performed for this isolated patch. Existing rejection-path hangs on other Android versions are deferred to a separate fix; no tests were disabled.

Fixes #136456

Note

This PR and its description were prepared with GitHub Copilot.

Avoid querying incomplete handshake cipher information during certificate validation on Android API 24, 25, 27, and 28. Preserve early metadata on API 26 and 29+ and keep the handshake-completion refresh unchanged.

Expand Android root-trust coverage across protocols and client/server validation roles, including callback-time metadata and encrypted data exchange.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d1eb39b-b333-42a0-b862-cefce2a6c517
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@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.

@simonrozsival simonrozsival changed the title Fix SslStream handshake connection info queries on older Android versions [Android] Fix SslStream handshake connection info queries on older Android versions Oct 27, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run runtime-android

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run runtime-android

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

This branch has not been deployed

No deployments
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.

[Android] SslStream on Android 9 (API 28) fails with ArgumentException "SSL_NULL_WITH_NULL_NULL" since .NET 11 Preview 4 — is this expected?

3 participants