Welcome

首页 / 软件开发 / WCF / WCF NetTcpBinding Transport安全模式(6)

WCF NetTcpBinding Transport安全模式(6)2014-06-26ClientCredentialType证书验证模式---- PeerTrust验证模式

当证书验证模式设置为“PeerTrust”时,服务端或者客户端会验 证证书是否存在于TrustedPeople 证书存储区中。

修改配置文件采用“PeerTrust”验证模式如以下代码。

在服务端设置对客户端的验证模式设置为“PeerTrust”:

<clientCertificate > <certificate findValue="XuanhunClient" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName"/><authentication certificateValidationMode="PeerTrust" trustedStoreLocation="CurrentUser"/> </clientCertificate>
在客户端设置对服务端验证模式设置为“PeerTrust”:

 <serviceCertificate ><defaultCertificatex509FindType="FindBySubjectName"storeLocation="CurrentUser"storeName="My"findValue="XuanhunServer"/><authentication certificateValidationMode="PeerTrust"/></serviceCertificate>
在运行程序之前,先来看看前面生成的证书目前存放在哪里。启动mmc控制台 ,添加新的管理单元,选择证书,然后添加当前用户和本地计算机两个节点,如 图11-14所示。

图11-14               添加证书管理单元

添加管理单元之后,查看当前用户下的各类证书,如图11-15所示。

图11-15        查看证书