Avishay Ben Shabtai
Avishay Ben Shabtai

Reputation: 76

Using client certificate with WebSocket4Net

My server is a running using SuperWebSocket with the following code for the server:

var server = new WebSocketServer();
var config = new ServerConfig();
config.Port = 4015;
config.Security = "Tls";
config.Certificate = new CertificateConfig{
    FilePath = serverConfiguration.Certificate.Path,
    ClientCertificateRequired = true
}            
server.Setup(config);
server.Start();

For client I am trying to use WebSocket4Net and I am trying to configure the certificate the client should present without any luck the current client code is:

var client = new WebSocket("wss://localhost:4015, "basic", WebSocketVersion.Rfc6455);
client.Open();

Upvotes: 2

Views: 2934

Answers (1)

Ratman
Ratman

Reputation: 166

As you stated in server configuration, your client needs to authenticate with a certificate. But I can't see any certificate in your client connection.

As a matter of fact, I can see no way to specify those certificates. I browsed the sources on github and found out that SuperWebSocket4Net is built on SuperSocket ClientEngine (from the same author). In the ClientEngine there's a class named SslStreamTcpSession. Here the SLL client is created and used for authentication, and here you can put your certificates. Maybe we can ask the author to add a feature: the chance to set the certificates for client auth.

Upvotes: 1

Related Questions