Skip to content
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

[Android] Remove repeated calls to beginHandshake #78849

Conversation

simonrozsival
Copy link
Member

@simonrozsival simonrozsival commented Nov 25, 2022

On legacy Android APIs (26 and earlier) the SSLEngine.beginHandshake() Java method cannot be called when the handshake has already been started. This has been fixed in later Android revisions (which we use in CI).

There's a related problem: during the handshake process, the SSLSession isn't accessible and it's necessary to call the SSLEngine.getHandshakeSession() to get the reference to the session that's being constructed (see https://developer.android.com/reference/javax/net/ssl/SSLSocket#getHandshakeSession() for more info). That prompted several other changes in the pal_sslstream.c.

This PR fixes SslStream on Android APIs 24-26.

Closes #78716
Related to #77386

@ghost
Copy link

ghost commented Nov 25, 2022

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

Issue Details

On legacy Android APIs (26 and earlier) the SSLEngine.beginHandshake() Java method cannot be called when the handshake has already been started. This has been fixed in later Android revisions (which we use in CI).

There's a related problem: during the handshake process, the SSLSession isn't accessible and it's necessary to call the SSLEngine.getHandshakeSession() to get the reference to the session that's being constructed (see https://developer.android.com/reference/javax/net/ssl/SSLSocket#getHandshakeSession() for more info). That prompted several other changes in the pal_sslstream.c.

Closes #78716
Related to #77386

Author: simonrozsival
Assignees: -
Labels:

area-System.Net.Security, os-android

Milestone: -

@simonrozsival
Copy link
Member Author

/azp run runtime-android

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@simonrozsival
Copy link
Member Author

/azp run runtime-androidemulator

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@simonrozsival
Copy link
Member Author

CI failures are unrelated to this PR.

@simonrozsival simonrozsival merged commit c7460d0 into dotnet:main Nov 30, 2022
@simonrozsival simonrozsival deleted the fix-android-repeated-calls-to-beginhandshake branch November 30, 2022 08:28
@steveisok
Copy link
Member

/backport to release/7.0

@steveisok
Copy link
Member

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3584440281

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/3584441419

simonrozsival added a commit to simonrozsival/runtime that referenced this pull request Dec 6, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2022
@karelz karelz added this to the 8.0.0 milestone Mar 22, 2023
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.

[Android] SSLStream throws 'Handshake has already been started' on API level 26
5 participants