C# 将SSL证书与斑点WebSocket一起使用

C# 将SSL证书与斑点WebSocket一起使用,c#,websocket,wss,C#,Websocket,Wss,当我将斑点指向我的OpenSsl证书或cloudflare证书时,会出现此错误 Failed to Authenticate System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.Componen

当我将斑点指向我的OpenSsl证书或cloudflare证书时,会出现此错误

Failed to Authenticate System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
   --- End of inner exception stack trace ---
   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
   --- End of inner exception stack trace ---
   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)<---
无法对系统进行身份验证。AggregateException:发生一个或多个错误。-->System.Security.Authentication.AuthenticationException:调用SSPI失败,请参阅内部异常。-->System.ComponentModel.Win32Exception:处理证书时发生未知错误
---内部异常堆栈跟踪的结束---
位于System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult-lazyResult)
位于System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult结果)
位于System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
在System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar、Func`2 endFunction、Action`1 endAction、Task`1 Promission、Boolean requiresSynchronization)
---内部异常堆栈跟踪的结束---
--->(内部异常#0)System.Security.Authentication.AuthenticationException:调用SSPI失败,请参阅内部异常。-->System.ComponentModel.Win32Exception:处理证书时发生未知错误
---内部异常堆栈跟踪的结束---
位于System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult-lazyResult)
位于System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult结果)
位于System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)

在System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar、Func`2 endFunction、Action`1 endAction、Task`1 promise、Boolean requiresSynchronization)中,这通常意味着客户端使用的SSL协议与服务器不同。您可以通过以下方式指定服务器上支持的SSL协议:

WebSocketServer ws = new WebSocketServer(wsUri)
{
EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12
};