cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to configure Dotnet SDK with valid security certificate

rkandasamy
7-Bedrock

How to configure Dotnet SDK with valid security certificate

Hi Team,

If any body has done connecting dot net SDK with valid security certificate to thingworx. Please provide the steps to be followed.

like Adding certificate to MMC -> Local system, how to Refer the same in dot net SDK?

I am stuck at adding security certificate to dot net SDK. Thanks.

2 REPLIES 2

Note:

I have used the below configuration and tried to add the certificates through config variable but not working.

URL: wss://******:443/Thingworx/WS  In the App.config file.

   mAppKey = ConfigurationManager.AppSettings["ServiceKey"].Trim();

            SecurityClaims claims = SecurityClaims.fromAppKey(mAppKey);

            config.ServerCertFileInfo = new CertFileInfo();

            config.ServerCertFileInfo.FilePath = "../Incoming/RootCert.cer";

                        config.Claims = claims;

            //config.AllowSelfSignedCertificates = false;

            config.AutoReconnect = true;

            config.ReconnectInterval = 5000;

            config.DisableCertValidation = true;

            config.setAsSDKType();

            config.ignoreSSLErrors(true);

Results: I am getting the error as follows,

com.thingworx.communications.client.TwApiWrapper Error: 0 : [Error] Error intializing SSL connection

com.thingworx.communications.client.TwApiWrapper Error: 0 : [Error] twWs_Connect: Error restarting socket.  Error 0

The program '[14540] EdgeSDK.vshost.exe' has exited with code 0 (0x0).

jknorr
6-Contributor
(To:rkandasamy)

Hi, i have a similar problem when trying to connect with the .net SDK to Thingworx.

I used this configuration:

config.ServerCertFileInfo = new CertFileInfo();

config.ServerCertFileInfo.FilePath = "pathtocer.cer";      

config.AllowSelfSignedCertificates = false;

config.DisableCertValidation = false;

var claims = SecurityClaims.fromAppKey(appKey);         

config.Claims = claims;

It works fine if DisableCertValidation is set to true, but when the validation is enabled the following error occurs:

"[Error] twTlsClient_Connect: Error intializing TLS connection.  Invalid certificate"

I don't think that the certificate is the issue, because i used the same .cer file for validation when connecting with openssl to the server.

Has anybody an idea what the problem might be or is there any other update on this topic?

Announcements


Top Tags