Skip to main content
15-Moonstone
February 7, 2022
Question

How to configure SSL certificate programmatically

  • February 7, 2022
  • 1 reply
  • 3061 views

Hi,

 

I have a config.json (it works fine) like

 

 

 

{
 "certificates": {
 "validate": true,
 "allow_self_signed": false,
 "cert_chain": [
 "/path2cert/entrust_l1k.pem",
 "/path2cert/entrust_g2.pem"
 ]
 }
 ...
}

 

 

 

 

How could i write it in programming? Because ServerCertFileInfo property only allow me to specify one cert file

 

 

 

var client = new ConnectedThingClient(new ClientConfigurator
{
	AllowSelfSignedCertificates = false, 
	DisableCertValidation = false,
	ServerCertFileInfo = new CertFileInfo { CertType = 0 /* TLS */, FilePath = @"/path2cert/entrust_g2.pem" },
	
	...
});

 

 

 

 

Any help would be greatly appreciated

 

Regards,

Hung Tran

 

 

1 reply

24-Ruby III
February 7, 2022

 Hi,

 

Some helpful articles:

 

From "Help Center" - ".NET SDK: ClientConfigurator Class": http://support.ptc.com/help/edge_sdk_dotnet/r5.8.0/en/index.html#page/dotnet_sdk/c_dotnet_sdk_reference_clientconfigurator_class.html 

 

Discussion earlier - "Client certificate authentication in Java": https://community.ptc.com/t5/ThingWorx-Developers/Client-certificate-authentication-in-Java/td-p/528567 

htran-2115-MoonstoneAuthor
15-Moonstone
February 7, 2022

Hi,

 

Thanks for your quick reply, however you misread my question, the Thingworx server is configured properly, it's already been working with config.json + wsems / localems. I just don't know how to setup cert chain for the ClientConfigurator object.

 

Regards,

Hung Tran

5-Regular Member
February 8, 2022

Hello @htran-21 ,

 

pls check the following article to set up cert for CCO.

https://www.ptc.com/en/support/article/cs272670

 

Let me know if that helps.

 

Regards

Bhawna