【问题标题】:Client authentication - dealing with client-side ceritificates客户端身份验证 - 处理客户端证书
【发布时间】:2016-09-26 03:35:30
【问题描述】:

我有一个 ASP.net Web 应用程序,我的客户需要使用客户端 v3 证书对我的网站进行身份验证。

我需要检查的是: 1-证书有效 2- “发给 CN” 有特定的价值

我在 MVC 操作中执行以下操作:

var req = Request.ClientCertificate;

req 有一个名为IsValid 的属性,足以满足要求 (1)。现在,这里的问题是我无法检查 CN,因为我相信它存储在另一个名为 byte[0] 类型的属性中,称为 Certificate

我尝试像这样阅读证书:

var x509 = new X509Certificate(req.Certificate);

但我有两个例外:

'x509.Issuer' threw an exception of type 'System.Security.Cryptography.CryptographicException'
'x509.Subject' threw an exception of type     'System.Security.Cryptography.CryptographicException'

如何阅读证书?

【问题讨论】:

    标签: asp.net authentication ssl x509certificate


    【解决方案1】:

    典型的方法是将证书属性(例如主题或 CN)映射到一个或多个用户。这是通过IIS configuration 完成的。

    完成之后,MVC要做的就是check the current user

    另见this article

    【讨论】:

      猜你喜欢
      • 2011-04-09
      • 2013-10-07
      • 2012-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-12
      • 2021-02-02
      • 2022-06-23
      相关资源
      最近更新 更多