-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Comments
From @lilleydnSub on Mon, 15 Jan 2024 15:18:27 GMT Its also fails on Mac and Android too |
From @rolfbjarne on Mon, 15 Jan 2024 16:09:03 GMT
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 |
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. |
From @rolfbjarne on Mon, 15 Jan 2024 16:38:05 GMT Does it work in a plain .NET 8 console project? |
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 |
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. |
Tagging subscribers to this area: @dotnet/ncl Issue DetailsFrom @lilleydnSub on Mon, 15 Jan 2024 15:17:47 GMT Steps to ReproduceConnecting with Local Qnap Server with a self signed cert TLS 1.3 Only fails but TLS 1.2 or Newer works fine.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SERVERADDR); If you are using my self contained project, you will need to change the Server Address in ViewController Expected BehaviorWebRequest returns happly Actual BehaviorWebRequest 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 EnvironmentVersion information
Build LogsExample Project (If Possible)Copied from original issue xamarin/xamarin-macios#19823
|
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones Issue DetailsFrom @lilleydnSub on Mon, 15 Jan 2024 15:17:47 GMT Steps to ReproduceConnecting with Local Qnap Server with a self signed cert TLS 1.3 Only fails but TLS 1.2 or Newer works fine.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SERVERADDR); If you are using my self contained project, you will need to change the Server Address in ViewController Expected BehaviorWebRequest returns happly Actual BehaviorWebRequest 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 EnvironmentVersion information
Build LogsExample Project (If Possible)Copied from original issue xamarin/xamarin-macios#19823
|
This is essentially dup of #1979. |
The call stack says it's for/from |
ok, I'll re-open it so Mono team can take a look. Maybe this is the native HTTP handler. |
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. |
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. |
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.
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.WebCompletionSource
1[T].WaitForCompletion () [0x0008e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/WebCompletionSource.cs:111at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task
1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func
1[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:956at 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
Build Logs
Example Project (If Possible)
ScratchiOS.zip
Copied from original issue xamarin/xamarin-macios#19823
The text was updated successfully, but these errors were encountered: