Hakim Marley
Hakim Marley

Reputation: 331

An unknown error occurred while processing the certificate

I have a self-signed certificate and i would like to use it on my websockets server to handle requests from wss://localhost:443. I connect to the server from any web-browser.

However, i cant seem to get the authentication right. Everytime i try to connect to the WebSockets Server via Advanced Rest Client (ARC) software, i type wss://localhost:443 or wss://127.0.0.1:443,

Am getting the exception

"System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate".

I created the certificate using openssl for windows and created a very simple certificate. Still i cant get the authentication right. Any help?

Here is how am trying to go about it with the C# code


var serverCertificate = new X509Certificate2("E:\\TestsFolder\\test-cert.pfx", "12345");
var certificates = new X509CertificateCollection { serverCertificate };

Stream stream = tcpClient.GetStream();

SslStream sslStream = new SslStream(stream, false,
                    (o, x509Certificate, chain, errors) => true,
                    (o, s, collection, x509Certificate, issuers) => certificates[0]);

await sslStream.AuthenticateAsServerAsync(serverCertificate, false, SslProtocols.Tls12, false);

WebSocketHttpContext context = await _webSocketServerFactory.ReadHttpHeaderFromStreamAsync(sslStream, source.Token);

What on earth could i be missing?

Here is a shot of my console with the exception

enter image description here

Upvotes: 2

Views: 6092

Answers (1)

vinny james
vinny james

Reputation: 36

We made our websockets server to use TLS 1.2.

Adding manually:

ws.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;

solved the issue.

Upvotes: 1

Related Questions