Why doesn't SslStream throw a descriptive exception to the client in this scenario? The consumer passed a certificate which didn't have a private key. I understand not throwing immediately as the server might not ask for it and that would break existing code, but the point where the server requests the client certificate and the client can't prove it has the private key, when the server aborts the handshake I would expect something to be mentioned about this problem in the exception message.
Linux - SslStream.AuthenticateAsClient is not presenting client certificates to server
This issue exists on Linux only
When establishing a connection to a TCP server where a client certificate is required, the client certificate does not get passed to the server side. The connection then gets aborted by the server, resulting in an exception as below.
Using NetMon, we can observe during that handshake that the server successfully sends its certificate to the client, but the client never presents the client certificate to the server. At this point, the server will send an RST and the connection is killed.
I've isolated the repro to using just a TcpClient and TcpServer + SslStream - see https://gist.github.com/iamjasonp/27cd1ebce287f8b51d0e for the rudimentary repro.
Platforms tested - .NET Desktop - :white_check_mark: - .NET Core - Windows: :white_check_mark: - .NET Core - Linux: :x:
First chance exception caught:
'System.Security.Authentication.AuthenticationException' in System.dll
Additional information: The remote certificate is invalid according to the validation procedure.
Server call stack:
System.dll!System.Net.Security.SslState.ForceAuthentication(bool receiveFirst, byte[] buffer, System.Net.AsyncProtocolRequest asyncRequest)
System.dll!System.Net.Security.SslState.ProcessAuthentication(System.Net.LazyAsyncResult lazyResult)
System.dll!System.Net.Security.SslStream.AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
TcpRepro-Server.exe!Examples.System.Net.SslTcpServer.ProcessClient(System.Net.Sockets.TcpClient client)
TcpRepro-Server.exe!Examples.System.Net.SslTcpServer.RunServer()
TcpRepro-Server.exe!Examples.System.Net.SslTcpServer.Main(string[] args)
This also looks to be the root cause of the issue in https://github.com/dotnet/wcf/issues/619#issuecomment-173177433
该提问来源于开源项目:dotnet/runtime
- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答
15条回答
为你推荐
- 对于货币应用,使用整数作为小数系数而不是浮点数是个好主意吗?
- 3个回答
- PHP挂起问题与passthru()/ system()调用和输出缓冲
- 如何创建一个花哨的“添加标签”系统[关闭]
- <anonymous>上的JQuery parseerror
- 允许片段未设置的JSON选项
- 集成嵌入式CSV文件 - PHP
- php
- 1个回答
- 实时传感器数据作为Python发送事件(SSE)从PHP到PHP?
- 隐藏真实背后的机制是什么?
- php
- 1个回答
- 基于IF语句通过PHP调用JS函数的问题
- php
- javascript
- 3个回答
- 传递.php文件作为参数
- php
- 3个回答
- 在PHPmyADMIN或Navicat中运行时,SQL代码不会占用
- SQL Query在PHPMyAdmin中运行良好,但在mysql_query中运行不正常
- Pass-Muraille
- less
- 1个回答
- Nasty Hacks
- 2个回答
- Evacuation Plan
- 2个回答