前面介绍Windows认证用户名/密码认证这两种典型的客户端认证模式,我们最后来介绍最后一种客户端认证方式,即客户端凭证类型为X.509证书时服务端采用的认证,简称为证书认证。我们照例先看看看客户端证书凭证如何设置设置。

服务认证一文中,我们知道了基于X.509证书证书的服务凭证通过X509CertificateRecipientServiceCredential类型表示。与之对应地,客户端凭证对应的类型是X509CertificateInitiatorClientCredential。如下面的定义所示,在终结点行为 ClientCredentials中,具有一个只读的ClientCertificate属性,其类型就是X509CertificateInitiatorClientCredential。该类型实际上是对一个X509Certificate2类型对象的封装,我们可以通过两个SetCertificate方法重载以证书引用的方式指定某个具体的X.509证书作为客户端的凭证。

class ClientCredentials : SecurityCredentialsManager, IEndpointBehavior
   2: {    
//其他成员
public X509CertificateInitiatorClientCredential ClientCertificate { get; }
   5: }
class X509CertificateInitiatorClientCredential
   7: {
//其他成员
string subjectName, StoreLocation storeLocation, StoreName storeName);
object findValue);
public X509Certificate2 Certificate { get; set; }
  12: }

相关文章:

  • 2021-07-06
  • 2022-01-21
  • 2021-11-22
  • 2021-07-26
  • 2021-06-17
  • 2022-12-23
猜你喜欢
  • 2021-06-14
  • 2021-10-06
  • 2021-08-16
  • 2021-12-14
相关资源
相似解决方案