Transfer layer security enhancement (TLS/SSL)

SuperSocket support the transport layer encryption (TLS/SSL) in synchronous mode (Sync).

First, you need to prepare the certificate file (with private key) used for encrypting. The certificate file used for testing purpose can be generated by the CertificateCreator in SuperSocket (, and then import the generated certificate file (. pfx) into the test server's trusted certificate directory. Production certificate need to submit an application to the certificate authority to get a certificate file. After receive the certificate file, export the certificate file with private key (.pfx) in the production server's certificate manager.

Then, add the transfer security node in the configuration file like below code:
<server name="SecureSuperWebSocket"
    <certificate filePath="supersocket.pfx"

Server node attribute security = "tls", said the transport layer to enable TLS encryption.
The new certificate child node is used for configuring the transport layer encryption certificate with the certificate file path and password which will be used for this server instance.

Last edited Jul 30, 2012 at 2:07 AM by kerryjiang, version 7


kerryjiang Jul 30, 2012 at 2:09 AM 
Did you check the err log in server and browser's script console?

vbguyny May 22, 2012 at 6:27 PM 
The following code doesn't work with the certificate that I created from the CertificateCreator. It works if I don't use SSL/TLS. Basically, the browser (Chrome 19 and FireFox 12) are unable to connect. Any ideas?


SuperSocket.SocketBase.Config.RootConfig r = new SuperSocket.SocketBase.Config.RootConfig();

SuperSocket.SocketBase.Config.ServerConfig s = new SuperSocket.SocketBase.Config.ServerConfig();
s.Name = "SuperWebSocket";
s.ServiceName = "SuperWebSocket";
s.Ip = "Any";
s.Port = 8089;
s.Mode = SocketMode.Async;

if (chkSSL.Checked == true)
//<!--Please install the certificate to your trusted certificates store, the password is 'supersocket'-->
//s.Mode = SocketMode.Sync;
s.Security = "tls";

SuperSocket.SocketBase.Config.CertificateConfig cert = new SuperSocket.SocketBase.Config.CertificateConfig();

cert.FilePath = @"C:\AstrosLocal\SSL\cosmos2.pfx";
cert.Password = @"12345";

cert.IsEnabled = true;

s.Certificate = cert;

SuperSocket.SocketEngine.SocketServerFactory f = new SuperSocket.SocketEngine.SocketServerFactory();

if (ws != null)
ws = null;

ws = new WebSocketServer();
ws.Setup(r, s, f);
ws.NewSessionConnected += new SessionEventHandler<WebSocketSession>(ws_NewSessionConnected);
ws.NewMessageReceived += new SessionEventHandler<WebSocketSession, string>(ws_NewMessageReceived);
ws.NewDataReceived += new SessionEventHandler<WebSocketSession, byte[]>(ws_NewDataReceived);