我有一个ASP.NET Core 1.1应用程序设置为使用Https并需要客户端证书:
我在Linux上运行应用程序。
如果我将ClientCertificateMode更改为" AllowCertificates",那么一切正常,但浏览器从不提示客户端证书。
使用" RequireCertificate"设置,我仍然没有得到浏览器提示证书的提示,我在服务器端得到以下两个例外(两次重复)并且没有响应返回浏览器:
Microsoft.AspNetCore.Server.Kestrel:错误:ConnectionFilter.OnConnection
System.AggregateException:发生了一个或多个错误。 (验证失败,因为远程方已关闭传输流。)---> System.IO.IOException:身份验证失败,因为远程方已关闭传输流。
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在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)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.d__3.MoveNext()
---内部异常堆栈跟踪结束---
---> (内部异常#0)System.IO.IOException:身份验证失败,因为远程方已关闭传输流。
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在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)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.d__3.MoveNext()< ---
Microsoft.AspNetCore.Server.Kestrel:错误:ConnectionFilter.OnConnection
System.AggregateException:发生了一个或多个错误。 (根据验证程序,远程证书无效。)---> System.Security.Authentication.AuthenticationException:根据验证过程,远程证书无效。
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken消息,AsyncProtocolRequest asyncRequest,ExceptionDispatchInfo异常)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在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)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.d__3.MoveNext()
---内部异常堆栈跟踪结束---
---> (内部异常#0)System.Security.Authentication.AuthenticationException:根据验证过程,远程证书无效。
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken消息,AsyncProtocolRequest asyncRequest,ExceptionDispatchInfo异常)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.StartReadFrame(Byte []缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)
在System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在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)
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.d__3.MoveNext()< ---
我花了大约四个小时尝试不同的事情和谷歌搜索,但我似乎无法弄清楚问题的核心原因是什么,所以我想我是否检查是否有人这里有个主意。
答案 0 :(得分:0)
不确定您是否找到了解决方案,但我最近遇到了类似的问题。我发现如果您没有任何由服务器信任的CA签名的客户端证书,则不会提示您。我的解决方案是将根CA添加到Linux中的信任存储区,之后将适当地发送/提示客户端证书。
答案 1 :(得分:0)
我最终使用IIS作为反向代理来获取证书信息(并进行验证),然后将其传递给Kestrel。