[英]Obtain expiration date / details about a WCF ssl certificate from .net client
From my .net client code, is there a way to obtain details about an SSL certificate being used by a WCF service? 从我的.net客户端代码中,是否可以获取有关WCF服务正在使用的SSL证书的详细信息? Assuming I can already connect successfully over SSL to the service.
假设我已经可以通过SSL成功连接到该服务。
I am hoping to report the expiration date of the server certificate on a dashboard. 我希望在仪表板上报告服务器证书的到期日期。 If the certificate has been updated / renewed since the last time the client communicated with the service, I'm trying to detect that as well.
如果自从上一次客户端与服务进行通信以来,证书已被更新/续订,那么我也将尝试检测到该证书。
Let's also assume the server cert is a real public cert from godaddy etc. ie the cert would not have been explicitly imported into the client store already. 我们还假设服务器证书是Godaddy等提供的真实公共证书,即该证书尚未显式导入到客户端存储中。
Any thoughts? 有什么想法吗? I was thinking I might find somewhere in System.ServiceModel.ClientBase that I could find this after opening a connection but haven't found anything yet.
我以为我可能在System.ServiceModel.ClientBase中找到某个地方,可以在打开连接后找到它,但尚未找到任何东西。
Thanks! 谢谢!
Easiest way would probably be to just implement a certificate validation callback on the client so that you can have a chance to look at the SSL certificate provided by the server before it is trusted by the client: 最简单的方法可能是仅在客户端上实现证书验证回调,以便您有机会在客户端信任之前查看服务器提供的SSL证书:
http://msdn.microsoft.com/en-us/library/aa702579(v=vs.110).aspx http://msdn.microsoft.com/zh-CN/library/aa702579(v=vs.110).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.