Forum › Developers › Cortex API › System.Exception:RemoteCertificateNameMismatch, RemoteCertificateChainErrors
Tagged: Certificates, Cortex Client, Cortex Service, Exceptions, Unity, Websocket
- This topic has 3 replies, 2 voices, and was last updated 3 years, 3 months ago by luckham jerill.
-
AuthorPosts
-
July 22, 2021 at 6:06 am #663
Hello everyone,
I’m using the Emotiv Unity examples & Emotiv Unity Plugin included in github. So far, so good, I was able to authenticate from the Cortex client running on Unity Editor, connect to the headsets, getting data and everything.
BUT, this is only working if I’m connecting to my localhost (Unity Editor pointing to the same computer, running Emotiv App + Cortex Service). If I try to connect from a different device (being another desktop computer or the Cortex client running on Android for instance), I’m getting the following websocket client errors:
System.Exception:RemoteCertificateNameMismatch, RemoteCertificateChainErrors
UnityEngine.Debug:Log (object)
EmotivUnityPlugin.CortexClient:WebSocketClient_Error (object,SuperSocket.ClientEngine.ErrorEventArgs) (at Assets/Plugins/Emotiv-Unity-Plugin/Src/CortexClient.cs:600)
WebSocket4Net.WebSocket:OnError (SuperSocket.ClientEngine.ErrorEventArgs)
WebSocket4Net.WebSocket:client_Error (object,SuperSocket.ClientEngine.ErrorEventArgs)
SuperSocket.ClientEngine.ClientSession:OnError (System.Exception)
SuperSocket.ClientEngine.SslStreamTcpSession:ValidateRemoteCertificate (object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)
Mono.Net.Security.Private.CallbackHelpers/<>c__DisplayClass0_0:<PublicToMono>b__0 (string,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,Mono.Security.Interface.MonoSslPolicyErrors)
Mono.Net.Security.Private.CallbackHelpers/<>c__DisplayClass5_0:<MonoToPublic>b__0 (object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)
System.Net.ServerCertValidationCallback:Invoke (object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)
Mono.Net.Security.ChainValidationHelper:ValidateChain (string,bool,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain&,System.Security.Cryptography.X509Certificates.X509CertificateCollection,System.Net.Security.SslPolicyErrors)
Mono.Net.Security.ChainValidationHelper:ValidateChain (string,bool,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Security.Cryptography.X509Certificates.X509CertificateCollection,System.Net.Security.SslPolicyErrors)
Mono.Net.Security.ChainValidationHelper:ValidateCertificate (string,bool,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain)
Mono.Net.Security.MobileTlsContext:ValidateCertificate (System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain)
Mono.Unity.UnityTlsContext:VerifyCallback (Mono.Unity.UnityTls/unitytls_x509list_ref,Mono.Unity.UnityTls/unitytls_errorstate*)
Mono.Unity.UnityTlsContext:VerifyCallback (void*,Mono.Unity.UnityTls/unitytls_x509list_ref,Mono.Unity.UnityTls/unitytls_errorstate*)
Mono.Unity.UnityTlsContext:ProcessHandshake ()
Mono.Net.Security.MobileAuthenticatedStream:ProcessHandshake (Mono.Net.Security.AsyncOperationStatus)
Mono.Net.Security.AsyncHandshakeRequest:Run (Mono.Net.Security.AsyncOperationStatus)
Mono.Net.Security.AsyncProtocolRequest/<ProcessOperation>d__24:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<System.Nullable
1<int>>:SetResult (System.Nullable`1<int>)
Mono.Net.Security.AsyncProtocolRequest/<InnerRead>d__25:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int>:SetResult (int)
Mono.Net.Security.MobileAuthenticatedStream/<InnerRead>d__66:MoveNext ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()System.Security.Authentication.AuthenticationException:A call to SSPI failed, see inner exception.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
at Mono.Net.Security.MobileAuthenticatedStream+<ProcessAuthentication>d__47.MoveNext () [0x00254] in <6815f06aed484ff088c24eff32dde63b>:0
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <695d1cc93cca45069c528c15c9fdd749>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <695d1cc93cca45069c528c15c9fdd749>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
at System.Threading.Tasks.TaskToApm.End (System.IAsyncResult asyncResult) [0x00029] in <695d1cc93cca45069c528c15c9fdd749>:0
at Mono.Net.Security.MobileAuthenticatedStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00000] in <6815f06aed484ff088c24eff32dde63b>:0
at System.Net.Security.SslStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00006] in <6815f06aed484ff088c24eff32dde63b>:0
at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated (System.IAsyncResult result) [0x00028] in <d48c73b87c95425b91162817ccffec2d>:0
UnityEngine.Debug:Log (object)
EmotivUnityPlugin.CortexClient:WebSocketClient_Error (object,SuperSocket.ClientEngine.ErrorEventArgs) (at Assets/Plugins/Emotiv-Unity-Plugin/Src/CortexClient.cs:600)
WebSocket4Net.WebSocket:OnError (SuperSocket.ClientEngine.ErrorEventArgs)
WebSocket4Net.WebSocket:client_Error (object,SuperSocket.ClientEngine.ErrorEventArgs)
SuperSocket.ClientEngine.ClientSession:OnError (System.Exception)
SuperSocket.ClientEngine.SslStreamTcpSession:OnAuthenticated (System.IAsyncResult)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Mono.Net.Security.MobileAuthenticatedStream/<ProcessAuthentication>d__47:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Mono.Net.Security.AsyncProtocolResult>:SetResult (Mono.Net.Security.AsyncProtocolResult)
Mono.Net.Security.AsyncProtocolRequest/<StartOperation>d__23:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Mono.Net.Security.AsyncProtocolRequest/<ProcessOperation>d__24:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<System.Nullable
1<int>>:SetResult (System.Nullable`1<int>)
Mono.Net.Security.AsyncProtocolRequest/<InnerRead>d__25:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int>:SetResult (int)
Mono.Net.Security.MobileAuthenticatedStream/<InnerRead>d__66:MoveNext ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()Mono.Security.Interface.TlsException
UnityEngine.Debug:Log (object)
EmotivUnityPlugin.CortexClient:WebSocketClient_Error (object,SuperSocket.ClientEngine.ErrorEventArgs) (at Assets/Plugins/Emotiv-Unity-Plugin/Src/CortexClient.cs:603)
WebSocket4Net.WebSocket:OnError (SuperSocket.ClientEngine.ErrorEventArgs)
WebSocket4Net.WebSocket:client_Error (object,SuperSocket.ClientEngine.ErrorEventArgs)
SuperSocket.ClientEngine.ClientSession:OnError (System.Exception)
SuperSocket.ClientEngine.SslStreamTcpSession:OnAuthenticated (System.IAsyncResult)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Mono.Net.Security.MobileAuthenticatedStream/<ProcessAuthentication>d__47:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Mono.Net.Security.AsyncProtocolResult>:SetResult (Mono.Net.Security.AsyncProtocolResult)
Mono.Net.Security.AsyncProtocolRequest/<StartOperation>d__23:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Mono.Net.Security.AsyncProtocolRequest/<ProcessOperation>d__24:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<System.Nullable
1<int>>:SetResult (System.Nullable`1<int>)
Mono.Net.Security.AsyncProtocolRequest/<InnerRead>d__25:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int>:SetResult (int)
Mono.Net.Security.MobileAuthenticatedStream/<InnerRead>d__66:MoveNext ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()As I understand, this is caused by the certificate validation used by the Cortex service exposed as a websocket. It’s only valid if I use localhost.
What can I do here? I’ve tried to use the following, with no luck either:
_wSC.Security.AllowNameMismatchCertificate = true;
_wSC.Security.AllowCertificateChainErrors = true;Thanks in advance,
- This topic was modified 3 years, 4 months ago by lastname60ee41ea0ee2e. Reason: adding topic tags
July 23, 2021 at 1:24 am #665Hello!
Thank you for your post. Currently, Cortex doesn’t allow a remote connection except Cortex on Raspberry. If you have other questions, please let us know.
July 23, 2021 at 5:41 am #671Thanks SO much for your prompt response Luckham.
Is it something that you are considering on your roadmap? Is there any workaround that I could take in order to accomplish what I need?
July 26, 2021 at 10:33 pm #675Hello,
At the moment, we are not considering to add this feature for remote connection to other OS for now.
-
AuthorPosts
- You must be logged in to reply to this topic.