.net – MVC中的客户端证书颁发者(指纹)
发布时间:2020-12-16 09:48:10 所属栏目:asp.Net 来源:网络整理
导读:在MVC应用程序中,我需要验证客户端证书是否由特定CA签名/签发. 我知道如何从中获取Request.ClientCertificate和X509Certificate2,但我无法弄清楚如何检查发行者. Request.ClientCertificate.Issuer给出了Issuer的主题,但我认为这不够安全. 我希望能够检查发
在MVC应用程序中,我需要验证客户端证书是否由特定CA签名/签发.
我知道如何从中获取Request.ClientCertificate和X509Certificate2,但我无法弄清楚如何检查发行者. 我希望能够检查发行者指纹,那么如何从客户端证书中检索它? 解决方法// get the X509 from HTTP client certificate var x509 = new X509Certificate2(this.Request.ClientCertificate.Certificate); // create the certificate chain by using the machine store var chain = new X509Chain(true); chain.ChainPolicy.RevocationMode = X509RevocationMode.Offline; chain.Build(x509); // at this point chain.ChainElements[0] will contain the original // certificate,the higher indexes are the issuers. // note that if the certificate is self-signed,there will be just one entry. var issuer = chain.ChainElements[1].Certificate.Thumbprint; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- mime-types – 在ASP.NET 5中使用MimeMapping(vNext)
- 我心中的ASP.NET Core 新核心对象WebHost(二)
- 如何在glimpse / Asp.NET MVC中显示控制器使用的例程的时间
- ASP.NET Core 中的框架级依赖注入
- asp.net-mvc – HttpContext和HttpContextWrapper之间的区别
- asp.net-mvc – 如何在ASP.net MVC 4 RouteConfig.cs中使用
- asp.net – 由于端口小于1024,无法打开包含网站的解决方案?
- asp-classic – 使用Webmatrix Razor替换经典ASP站点
- asp.net-mvc – 如何利用Resharper的“导航到控制器方法”功
- Asp.Net MVC验证 – 依赖字段