TsgcWebSocketServer_HTTPAPI | HTTPAPI Server SSL

The 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, etc. For testing purposes you can use a self-signed certificate (check the Demos/Chat example which uses a self-signed certificate). Read the following article How Create a Self-signed certificate.

 

Once you have your certificate, you must configure the server to specify which certificate to use for encrypting connections.

 

Certificate Hash

First you need to know 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 the hash, just set TsgcWebSocketServer_HTTPAPI.SSL = true and your server is ready to start.

 

 

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. Do not 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.