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

iOS Connecting with Server with TLS 1.3 Only fails #97025

Closed
rolfbjarne opened this issue Jan 16, 2024 · 13 comments
Closed

iOS Connecting with Server with TLS 1.3 Only fails #97025

rolfbjarne opened this issue Jan 16, 2024 · 13 comments

Comments

@rolfbjarne
Copy link
Member

From @lilleydnSub on Mon, 15 Jan 2024 15:17:47 GMT

Steps to Reproduce

Connecting with Local Qnap Server with a self signed cert TLS 1.3 Only fails but TLS 1.2 or Newer works fine.

  1. Have a server with TLS 1.3 only
  2. Connect with code See attached example

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SERVERADDR);
request.Method = "GET";
request.ContentType = "application/json";

If you are using my self contained project, you will need to change the Server Address in ViewController

Expected Behavior

WebRequest returns happly

Actual Behavior

WebRequest creates exception with :

System.Net.WebException: Error: SecureChannelFailure (Authentication failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Security.Interface.TlsException: Unknown Secure Transport error PeerProtocolVersion'. at Mono.AppleTls.AppleTlsContext.CheckStatusAndThrow (Mono.AppleTls.SslStatus status, Mono.AppleTls.SslStatus[] acceptable) [0x000c1] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:123 at Mono.AppleTls.AppleTlsContext.ProcessHandshake () [0x0002e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:209 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at Mono.Net.Security.MonoTlsStream.CreateStream (System.Net.WebConnectionTunnel tunnel, System.Threading.CancellationToken cancellationToken) [0x0016a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs:137 at System.Net.WebConnection.CreateStream (System.Net.WebOperation operation, System.Boolean reused, System.Threading.CancellationToken cancellationToken) [0x00170] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:236 --- End of inner exception stack trace --- at System.Net.WebConnection.CreateStream (System.Net.WebOperation operation, System.Boolean reused, System.Threading.CancellationToken cancellationToken) [0x00208] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:248 at System.Net.WebConnection.InitConnection (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x000f7] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:277 at System.Net.WebOperation.Run () [0x00052] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebOperation.cs:268 at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x0008e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebCompletionSource.cs:111
at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000e8] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:956
at System.Net.HttpWebRequest.GetResponse () [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:1218
at ScratchiOS.ViewController.AButton_TouchUpInside (System.Object sender, System.EventArgs e) [0x0002a] in /Users/davidlilley/Projects/ScratchiOS/ScratchiOS/ViewController.cs:47

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.6.8 (build 400)
Installation UUID: ecc45f8b-96a8-49aa-9a02-57f061f4c433

Runtime
.NET 7.0.3 (64-bit)
Architecture: X64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/7.0.403/Sdks
SDK Versions:
	7.0.403
	7.0.310
	7.0.309
	7.0.308
	7.0.307
	7.0.304
	7.0.302
	7.0.203
	7.0.202
	7.0.201
	7.0.200
	7.0.103
	7.0.102
	7.0.101
	7.0.100
	6.0.418
	6.0.417
	6.0.416
	6.0.415
	6.0.414
	6.0.413
	6.0.410
	6.0.408
	6.0.407
	6.0.406
	6.0.405
	6.0.404
	6.0.403
	6.0.402
	5.0.408
	5.0.406
	5.0.405
	5.0.404
	5.0.403
	5.0.402
	5.0.401
	5.0.400
	5.0.302
	5.0.301
	5.0.203
	5.0.202
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.426
	3.1.425
	3.1.424
	3.1.417
	3.1.416
	3.1.415
	3.1.414
	3.1.413
	3.1.412
	3.1.411
	3.1.410
	3.1.409
	3.1.408
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	7.0.13
	7.0.12
	7.0.11
	7.0.10
	7.0.7
	7.0.5
	7.0.4
	7.0.3
	7.0.2
	7.0.1
	7.0.0
	6.0.26
	6.0.25
	6.0.24
	6.0.23
	6.0.22
	6.0.21
	6.0.18
	6.0.16
	6.0.15
	6.0.14
	6.0.13
	6.0.12
	6.0.11
	6.0.10
	5.0.17
	5.0.15
	5.0.14
	5.0.13
	5.0.12
	5.0.11
	5.0.10
	5.0.9
	5.0.8
	5.0.7
	5.0.6
	5.0.5
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.32
	3.1.31
	3.1.30
	3.1.23
	3.1.22
	3.1.21
	3.1.20
	3.1.19
	3.1.18
	3.1.17
	3.1.16
	3.1.15
	3.1.14
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin.Android
Version: 13.2.2.0 (Visual Studio Community)
Commit: xamarin-android/d17-5/45b0e14
Android SDK: /Users/davidlilley/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		12.0 (API level 31)
		11.0 (API level 30)
		13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 34.0.3
SDK Build Tools Version: 32.0.0

Build Information: 
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite/3.40.1@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.16.1
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2024-01-03 23:07:53 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2024-01-03 23:07:53 UTC

Apple Developer Tools
Xcode: 15.1 22502
Build: 15C65

Xamarin.Mac
Version: 9.3.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:14:59-0400

Xamarin.iOS
Version: 16.4.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:15:00-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2024-01-03 23:07:48 UTC

Build Information
Release ID: 1706080400
Git revision: dfc3b79e7cc0dbc2710b239472a704042f66dad0
Build date: 2024-01-03 23:06:14+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 14.2.1
Darwin 23.2.0 Darwin Kernel Version 23.2.0
    Wed Nov 15 21:54:10 PST 2023
    root:xnu-10002.61.3~2/RELEASE_X86_64 x86_64


Build Logs

Example Project (If Possible)

ScratchiOS.zip

Copied from original issue xamarin/xamarin-macios#19823

@rolfbjarne
Copy link
Member Author

From @lilleydnSub on Mon, 15 Jan 2024 15:18:27 GMT

Its also fails on Mac and Android too

@rolfbjarne
Copy link
Member Author

From @rolfbjarne on Mon, 15 Jan 2024 16:09:03 GMT

a self signed cert

AFAIK a server with a self-signed certificate shouldn't work by default, so IMHO the question is why TLS 1.2 or lower works...

If you want to connect to such a server, you'll have to add your own certificate validation code and validate that the certificate is valid.

Something like this should work: https://stackoverflow.com/a/526803

@rolfbjarne
Copy link
Member Author

From @lilleydnSub on Mon, 15 Jan 2024 16:19:03 GMT

I thought the only way to do this working iOS is to add the cert to the Trusted Root Collection which has worked in the past, My concern is that TLS 1.3 is not working at all. Perhaps I should not mentioned its self signed cert.

IMG_A15106F087ED-1

@rolfbjarne
Copy link
Member Author

From @rolfbjarne on Mon, 15 Jan 2024 16:38:05 GMT

Does it work in a plain .NET 8 console project?

@rolfbjarne
Copy link
Member Author

From @lilleydnSub on Tue, 16 Jan 2024 08:47:10 GMT

Yes I have tested on the Mac on Console app .Net 7 and Net 8 and it works

@rolfbjarne
Copy link
Member Author

From @rolfbjarne on Tue, 16 Jan 2024 11:43:29 GMT

Since this is happening on Android as well, it doesn't sound like an issue for this repository, so I'm moving to dotnet/runtime.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 16, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 16, 2024
@ghost
Copy link

ghost commented Jan 16, 2024

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

Issue Details

From @lilleydnSub on Mon, 15 Jan 2024 15:17:47 GMT

Steps to Reproduce

Connecting with Local Qnap Server with a self signed cert TLS 1.3 Only fails but TLS 1.2 or Newer works fine.

  1. Have a server with TLS 1.3 only
  2. Connect with code See attached example

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SERVERADDR);
request.Method = "GET";
request.ContentType = "application/json";

If you are using my self contained project, you will need to change the Server Address in ViewController

Expected Behavior

WebRequest returns happly

Actual Behavior

WebRequest creates exception with :

System.Net.WebException: Error: SecureChannelFailure (Authentication failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Security.Interface.TlsException: Unknown Secure Transport error PeerProtocolVersion'. at Mono.AppleTls.AppleTlsContext.CheckStatusAndThrow (Mono.AppleTls.SslStatus status, Mono.AppleTls.SslStatus[] acceptable) [0x000c1] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:123 at Mono.AppleTls.AppleTlsContext.ProcessHandshake () [0x0002e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:209 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at Mono.Net.Security.MonoTlsStream.CreateStream (System.Net.WebConnectionTunnel tunnel, System.Threading.CancellationToken cancellationToken) [0x0016a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs:137 at System.Net.WebConnection.CreateStream (System.Net.WebOperation operation, System.Boolean reused, System.Threading.CancellationToken cancellationToken) [0x00170] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:236 --- End of inner exception stack trace --- at System.Net.WebConnection.CreateStream (System.Net.WebOperation operation, System.Boolean reused, System.Threading.CancellationToken cancellationToken) [0x00208] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:248 at System.Net.WebConnection.InitConnection (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x000f7] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:277 at System.Net.WebOperation.Run () [0x00052] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebOperation.cs:268 at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x0008e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebCompletionSource.cs:111
at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000e8] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:956
at System.Net.HttpWebRequest.GetResponse () [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:1218
at ScratchiOS.ViewController.AButton_TouchUpInside (System.Object sender, System.EventArgs e) [0x0002a] in /Users/davidlilley/Projects/ScratchiOS/ScratchiOS/ViewController.cs:47

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.6.8 (build 400)
Installation UUID: ecc45f8b-96a8-49aa-9a02-57f061f4c433

Runtime
.NET 7.0.3 (64-bit)
Architecture: X64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/7.0.403/Sdks
SDK Versions:
	7.0.403
	7.0.310
	7.0.309
	7.0.308
	7.0.307
	7.0.304
	7.0.302
	7.0.203
	7.0.202
	7.0.201
	7.0.200
	7.0.103
	7.0.102
	7.0.101
	7.0.100
	6.0.418
	6.0.417
	6.0.416
	6.0.415
	6.0.414
	6.0.413
	6.0.410
	6.0.408
	6.0.407
	6.0.406
	6.0.405
	6.0.404
	6.0.403
	6.0.402
	5.0.408
	5.0.406
	5.0.405
	5.0.404
	5.0.403
	5.0.402
	5.0.401
	5.0.400
	5.0.302
	5.0.301
	5.0.203
	5.0.202
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.426
	3.1.425
	3.1.424
	3.1.417
	3.1.416
	3.1.415
	3.1.414
	3.1.413
	3.1.412
	3.1.411
	3.1.410
	3.1.409
	3.1.408
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	7.0.13
	7.0.12
	7.0.11
	7.0.10
	7.0.7
	7.0.5
	7.0.4
	7.0.3
	7.0.2
	7.0.1
	7.0.0
	6.0.26
	6.0.25
	6.0.24
	6.0.23
	6.0.22
	6.0.21
	6.0.18
	6.0.16
	6.0.15
	6.0.14
	6.0.13
	6.0.12
	6.0.11
	6.0.10
	5.0.17
	5.0.15
	5.0.14
	5.0.13
	5.0.12
	5.0.11
	5.0.10
	5.0.9
	5.0.8
	5.0.7
	5.0.6
	5.0.5
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.32
	3.1.31
	3.1.30
	3.1.23
	3.1.22
	3.1.21
	3.1.20
	3.1.19
	3.1.18
	3.1.17
	3.1.16
	3.1.15
	3.1.14
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin.Android
Version: 13.2.2.0 (Visual Studio Community)
Commit: xamarin-android/d17-5/45b0e14
Android SDK: /Users/davidlilley/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		12.0 (API level 31)
		11.0 (API level 30)
		13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 34.0.3
SDK Build Tools Version: 32.0.0

Build Information: 
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite/3.40.1@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.16.1
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2024-01-03 23:07:53 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2024-01-03 23:07:53 UTC

Apple Developer Tools
Xcode: 15.1 22502
Build: 15C65

Xamarin.Mac
Version: 9.3.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:14:59-0400

Xamarin.iOS
Version: 16.4.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:15:00-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2024-01-03 23:07:48 UTC

Build Information
Release ID: 1706080400
Git revision: dfc3b79e7cc0dbc2710b239472a704042f66dad0
Build date: 2024-01-03 23:06:14+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 14.2.1
Darwin 23.2.0 Darwin Kernel Version 23.2.0
    Wed Nov 15 21:54:10 PST 2023
    root:xnu-10002.61.3~2/RELEASE_X86_64 x86_64


Build Logs

Example Project (If Possible)

ScratchiOS.zip

Copied from original issue xamarin/xamarin-macios#19823

Author: rolfbjarne
Assignees: -
Labels:

area-System.Net, untriaged, os-ios, needs-area-label

Milestone: -

@ghost
Copy link

ghost commented Jan 16, 2024

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

Issue Details

From @lilleydnSub on Mon, 15 Jan 2024 15:17:47 GMT

Steps to Reproduce

Connecting with Local Qnap Server with a self signed cert TLS 1.3 Only fails but TLS 1.2 or Newer works fine.

  1. Have a server with TLS 1.3 only
  2. Connect with code See attached example

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SERVERADDR);
request.Method = "GET";
request.ContentType = "application/json";

If you are using my self contained project, you will need to change the Server Address in ViewController

Expected Behavior

WebRequest returns happly

Actual Behavior

WebRequest creates exception with :

System.Net.WebException: Error: SecureChannelFailure (Authentication failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Security.Interface.TlsException: Unknown Secure Transport error PeerProtocolVersion'. at Mono.AppleTls.AppleTlsContext.CheckStatusAndThrow (Mono.AppleTls.SslStatus status, Mono.AppleTls.SslStatus[] acceptable) [0x000c1] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:123 at Mono.AppleTls.AppleTlsContext.ProcessHandshake () [0x0002e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:209 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at Mono.Net.Security.MonoTlsStream.CreateStream (System.Net.WebConnectionTunnel tunnel, System.Threading.CancellationToken cancellationToken) [0x0016a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs:137 at System.Net.WebConnection.CreateStream (System.Net.WebOperation operation, System.Boolean reused, System.Threading.CancellationToken cancellationToken) [0x00170] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:236 --- End of inner exception stack trace --- at System.Net.WebConnection.CreateStream (System.Net.WebOperation operation, System.Boolean reused, System.Threading.CancellationToken cancellationToken) [0x00208] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:248 at System.Net.WebConnection.InitConnection (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x000f7] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:277 at System.Net.WebOperation.Run () [0x00052] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebOperation.cs:268 at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x0008e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebCompletionSource.cs:111
at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000e8] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:956
at System.Net.HttpWebRequest.GetResponse () [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:1218
at ScratchiOS.ViewController.AButton_TouchUpInside (System.Object sender, System.EventArgs e) [0x0002a] in /Users/davidlilley/Projects/ScratchiOS/ScratchiOS/ViewController.cs:47

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.6.8 (build 400)
Installation UUID: ecc45f8b-96a8-49aa-9a02-57f061f4c433

Runtime
.NET 7.0.3 (64-bit)
Architecture: X64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/7.0.403/Sdks
SDK Versions:
	7.0.403
	7.0.310
	7.0.309
	7.0.308
	7.0.307
	7.0.304
	7.0.302
	7.0.203
	7.0.202
	7.0.201
	7.0.200
	7.0.103
	7.0.102
	7.0.101
	7.0.100
	6.0.418
	6.0.417
	6.0.416
	6.0.415
	6.0.414
	6.0.413
	6.0.410
	6.0.408
	6.0.407
	6.0.406
	6.0.405
	6.0.404
	6.0.403
	6.0.402
	5.0.408
	5.0.406
	5.0.405
	5.0.404
	5.0.403
	5.0.402
	5.0.401
	5.0.400
	5.0.302
	5.0.301
	5.0.203
	5.0.202
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.426
	3.1.425
	3.1.424
	3.1.417
	3.1.416
	3.1.415
	3.1.414
	3.1.413
	3.1.412
	3.1.411
	3.1.410
	3.1.409
	3.1.408
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	7.0.13
	7.0.12
	7.0.11
	7.0.10
	7.0.7
	7.0.5
	7.0.4
	7.0.3
	7.0.2
	7.0.1
	7.0.0
	6.0.26
	6.0.25
	6.0.24
	6.0.23
	6.0.22
	6.0.21
	6.0.18
	6.0.16
	6.0.15
	6.0.14
	6.0.13
	6.0.12
	6.0.11
	6.0.10
	5.0.17
	5.0.15
	5.0.14
	5.0.13
	5.0.12
	5.0.11
	5.0.10
	5.0.9
	5.0.8
	5.0.7
	5.0.6
	5.0.5
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.32
	3.1.31
	3.1.30
	3.1.23
	3.1.22
	3.1.21
	3.1.20
	3.1.19
	3.1.18
	3.1.17
	3.1.16
	3.1.15
	3.1.14
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin.Android
Version: 13.2.2.0 (Visual Studio Community)
Commit: xamarin-android/d17-5/45b0e14
Android SDK: /Users/davidlilley/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		12.0 (API level 31)
		11.0 (API level 30)
		13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 34.0.3
SDK Build Tools Version: 32.0.0

Build Information: 
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite/3.40.1@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.16.1
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2024-01-03 23:07:53 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2024-01-03 23:07:53 UTC

Apple Developer Tools
Xcode: 15.1 22502
Build: 15C65

Xamarin.Mac
Version: 9.3.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:14:59-0400

Xamarin.iOS
Version: 16.4.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:15:00-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2024-01-03 23:07:48 UTC

Build Information
Release ID: 1706080400
Git revision: dfc3b79e7cc0dbc2710b239472a704042f66dad0
Build date: 2024-01-03 23:06:14+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 14.2.1
Darwin 23.2.0 Darwin Kernel Version 23.2.0
    Wed Nov 15 21:54:10 PST 2023
    root:xnu-10002.61.3~2/RELEASE_X86_64 x86_64


Build Logs

Example Project (If Possible)

ScratchiOS.zip

Copied from original issue xamarin/xamarin-macios#19823

Author: rolfbjarne
Assignees: -
Labels:

area-System.Net.Security, untriaged, os-ios, needs-area-label

Milestone: -

@wfurt wfurt removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 16, 2024
@wfurt
Copy link
Member

wfurt commented Jan 16, 2024

This is essentially dup of #1979.

@wfurt wfurt closed this as completed Jan 16, 2024
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jan 16, 2024
@bartonjs
Copy link
Member

The call stack says it's for/from Mono.AppleTls. So, I'm not sure it's that dupe... but I'm also not sure it's even an issue for this repository.

@wfurt wfurt reopened this Jan 16, 2024
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 16, 2024
@wfurt
Copy link
Member

wfurt commented Jan 16, 2024

ok, I'll re-open it so Mono team can take a look. Maybe this is the native HTTP handler.

@filipnavara
Copy link
Member

The stack trace is from the old Mono from mono/mono. I am not sure anyone really cares at this point, it is going out of support in few months. It’s unrealistic that someone would update its TLS stack for the same reasons that are still true even on . NET 8+ today.

@rzikm
Copy link
Member

rzikm commented Mar 7, 2024

We can't transfer the issue to mono as it is in another organization. Given that we have tracking issue for TLS 1.3 on OSX for CoreCLR already, and that the old mono is going out of support soon, I think it is best to close this issue again without any further action.

@rzikm rzikm closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Mar 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants