Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to Secure WebSocket: Unknow error while processing the certificate #144

Open
Pablo-Jean opened this issue Jan 11, 2021 · 0 comments
Open

Comments

@Pablo-Jean
Copy link

Hello,

I'm using the WebSocketListener lib, it's very good, works fine when the scheme is ws://. But the server won't work when register for Secure WebSocket.

Whats happens is:
I start the server, well configured, with a certificate in .pfx format, associeted the private key.
The server starts without error. But when the client try to connect, I receive an exception with the message:

"Unknown error while processing the certificate"

The code in C#:

//generate cancellation Token
CancellationTokenSource cancellation = new CancellationTokenSource();

var endpoint = new IPEndPoint(IPAddress.Any, porta);
var rfc6455 = new WebSocketFactoryRfc6455();
var options = new WebSocketListenerOptions();
if (File.Exists(server_Config.CertificatePath))
{
    THREAD_MOD("Certificado carregado");
    cert = new X509Certificate2(server_Config.CertificatePath, server_Config.CertPassword);
}
else
{
    THREAD_MOD("Certificado ausente");
}
if (cert != null)
{
      WebSocketSecureConnectionExtension tls = new WebSocketSecureConnectionExtension(cert);
      server.ConnectionExtensions.RegisterExtension(tls);
      THREAD_MOD("Certificado registrado no wss://");
      certificate_str = cert.ToString();
      button_check_cert.Enabled = true;
}
else
{
     THREAD_MOD("Falha ao gerar/carregar certificado");
}
server.StartAsync(cancellation.Token);
task = AcceptWebSocketClientsAsync(server, cancellation.Token);

Sorry if I'm disturbing, cut it's been days since I start to try to use the wss:// scheme.

@Pablo-Jean Pablo-Jean changed the title Try to Secure WebSocket: Inknow error while processing the certificate Try to Secure WebSocket: Unknow error while processing the certificate Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant