TsgcWebSocketServer_HTTPAPI | HTTPAPI Server SSL

Server can be configured to use SSL Certificates, in order to get a Production Server with a server certificate, you must purchase a Certificate from a well known provider: Namecheap, godaddy, Thawte... For testing purposes you can use a self-signed certificate (check out in Demos/Chat which uses a self-signed certificate). Read the following article How Create a Self-signed certificate.

 

Once you have your certificate, you must configure in Server which certificate will use to encrypt connections.

 

Certificate Hash

First you need to know which is the Hash of your certificate. Finding the hash of a certificate is as easy in powershell as running a dir command on the certificates container.

dir cert:\localmachine\my

The hash is the hexadecimal Thumbprint value.

 


Directory: Microsoft.PowerShell.Security\Certificate::localmachine\my
Thumbprint                                Subject
----------                                -------
C12A8FC8AE668F866B48F23E753C93D357E9BE10  CN=*.mydomain.com

Once you have the Thumbprint value, just set in TsgcWebSocketServer_HTTPAPI.TLSOptions.Hash property.

 

Once you have set hash, just set TsgcWebSocketServer_HTTPAPI.SSL = true and your server is know ready to get started.

 

 

If you want to register the certificate manually using netsh, use the following command:

 

netsh http add sslcert ipport=<IP>:<PORT> certhash=<THUMBPRINT> appid="{<GUID>}"


<IP>: Specifies the local IP address for the binding. Don't use a wildcard binding. Use a valid IP address.
<PORT>: Specifies the port for the binding.
<THUMBPRINT>: The X.509 certificate thumbprint.
<GUID>: A developer-generated GUID to represent the app for informational purposes.