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

I am facing the UNITYTLS_INVALID_ARGUMENT issue. Unable to resolve it. #134

Open
ghost opened this issue Sep 2, 2021 · 1 comment
Open

Comments

@ghost
Copy link

ghost commented Sep 2, 2021

I have added the code snippets stack trace for the issue that I am facing.

For creating client:

                client = new MqttClient(
                        brokerHostName: mqttOptions.hostname,
                        brokerPort: mqttOptions.port,
                        secure: true,
                        caCert: null,
                        clientCert: null,
                        sslProtocol: MqttSslProtocols.SSLv3);

For connection


               client.Connect(
                    clientId: GameLauncher.MqttClientData.clientId,
                    username: GameLauncher.MqttClientData.userName,
                    password: GameLauncher.MqttClientData.password,
                    willRetain: false,
                    willQosLevel: MqttMsgConnect.QOS_LEVEL_EXACTLY_ONCE,
                    willFlag: false,
                    willTopic: "",
                    willMessage: "",
                    cleanSession: mqttOptions.clean,
                    keepAlivePeriod: mqttOptions.keepalive);
Failed to connect to broker:
uPLibrary.Networking.M2Mqtt.Exceptions.MqttConnectionException: Exception connecting to the broker ---> System.AggregateException: One or more errors occurred. ---> Mono.Security.Interface.TlsException: Failed to create UnityTls context - error code: UNITYTLS_INVALID_ARGUMENT
  at Mono.Unity.Debug.CheckAndThrow (Mono.Unity.UnityTls+unitytls_errorstate errorState, System.String context, Mono.Security.Interface.AlertDescription defaultAlert) [0x00027] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
  at Mono.Unity.UnityTlsContext..ctor (Mono.Net.Security.MobileAuthenticatedStream parent, System.Boolean serverMode, System.String targetHost, System.Security.Authentication.SslProtocols enabledProtocols, System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Boolean askForClientCert) [0x0029e] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
  at Mono.Unity.UnityTlsStream.CreateContext (System.Boolean serverMode, System.String targetHost, System.Security.Authentication.SslProtocols enabledProtocols, System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Boolean askForClientCert) [0x00000] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
  at Mono.Net.Security.MobileAuthenticatedStream+<ProcessAuthentication>d__47.MoveNext () [0x00121] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0000d] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
  at System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00006] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
  at uPLibrary.Networking.M2Mqtt.MqttNetworkChannel.Connect () [0x0008a] in D:\UnityProjects\jeet11-rummy\Assets\ThirdParty\M2Mqtt\Net\MqttNetworkChannel.cs:264 
  at uPLibrary.Networking.M2Mqtt.MqttClient.Connect (System.String clientId, System.String username, System.String password, System.Boolean willRetain, System.Byte willQosLevel, System.Boolean willFlag, System.String willTopic, System.String willMessage, System.Boolean cleanSession, System.UInt16 keepAlivePeriod) [0x0001e] in D:\UnityProjects\jeet11-rummy\Assets\ThirdParty\M2Mqtt\MqttClient.cs:562 
   --- End of inner exception stack trace ---
  at uPLibrary.Networking.M2Mqtt.MqttClient.Connect (System.String clientId, System.String username, System.String password, System.Boolean willRetain, System.Byte willQosLevel, System.Boolean willFlag, System.String willTopic, System.String willMessage, System.Boolean cleanSession, System.UInt16 keepAlivePeriod) [0x0002c] in D:\UnityProjects\jeet11-rummy\Assets\ThirdParty\M2Mqtt\MqttClient.cs:566 
  at Custom.Services.WebSockets.BaseMqttClient+<DoConnect>d__16.MoveNext () [0x0010c] in D:\UnityProjects\jeet11-rummy\Assets\Scripts\Common\WebSockets\BaseMqttClient.cs:94 
UnityEngine.Debug:LogErrorFormat (string,object[])
Custom.Services.WebSockets.BaseMqttClient/<DoConnect>d__16:MoveNext () (at Assets/Scripts/Common/WebSockets/BaseMqttClient.cs:109)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

@ilsnk
Copy link

ilsnk commented Jul 19, 2022

u solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant