kerryjiang / WebSocket4Net

A popular .NET WebSocket Client
752 stars 272 forks source link

RemoteCertificateNameMismatch With Wildcard Certificate on 0.15.0 #105

Closed FNJ5 closed 6 years ago

FNJ5 commented 6 years ago

I have a working application using WebSocket4Net 0.14.0, but need to have TLS1.2 support. I updated to the 0.15.0 DLL and now I cannot connect to my sever, getting a RemoteCertificateNameMismatch error. Did some digging into the CAPI2 logs in the Event Viewer, and I am getting a corresponding error message "The certificate's CN name does not match the passed value.". I believe version 0.15.0 introduced a bug with wildcard certificates.

I would be happy to provide any additionally information to help resolve this issue!

kerryjiang commented 6 years ago

Which platform's assembly do you use? .netstandard?

FNJ5 commented 6 years ago

We are using .NET Framework 3.5

kerryjiang commented 6 years ago

Could you tell me your websocket server's address? Let me write a test case for it.

FNJ5 commented 6 years ago

I've sent you an email with the requested information.

kerryjiang commented 6 years ago

I did a fix already. But you also can work around this issue by setting AllowMisMatchCertificate.

using SuperSocket.ClientEngine;

client.Security.AllowNameMismatchCertificate = true;

FNJ5 commented 6 years ago

Updated the WebSocket4Net dependency SuperSocket.ClientEngine.Core to v0.8.0.14 and the issue has been resolved!

Really appreciate your help, thanks!