指定要用于为对等客户端的消息进行签名和加密的 X.509 证书。
架构层次结构
<system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <endpointBehaviors> 的 <behavior>
        <clientCredentials>
          <clientCredentials> 的 <peer> 元素
            <certificate> 元素
语法
<certificate findValue="String" 
     
storeLocation="LocalMachine/CurrentUser"
      storeName="AddressBook/AuthRoot/CertificateAuthority/Disallowed/My/Root/TrustedPeople/TrustedPublisher"
      X509FindType="FindByThumbPrint/FindBySubjectName/FindBySubjectDistinguishedName/FindByIssuerName/FindByIssuerDistinguishedName/FindBySerialNumber/FindByTimeValid/FindByTimeNotYetValid/FindByTemplateName/FindByApplicationPolicy/FindByCertificatePolicy/FindByExtension/FindByKeyUsage/FindBySubjectKeyIdentifier"
/>
属性和元素
以下几节描述了特性、子元素和父元素。
属性
| 特性 | 说明 | 
|---|---|
| findValue | 一个字符串,包含要在 X.509 证书存储中搜索的值。此属性中包含的类型必须满足指定 x509FindType 的要求。默认值为一个空字符串。 | 
| storeLocation | 指定客户端可用于验证对等方的证书的 X.509 证书存储的位置。包括以下有效值: 
 默认值为 LocalMachine。 | 
| storeName | 指定要打开的 X.509 证书存储的名称。包括以下有效值: 
 默认值为 My。 | 
| X509FindType | 定义要执行的 X.509 搜索的类型。包括以下有效值: 
 findValue 属性中包含的类型必须满足指定 X509FindType 的要求。 默认值为 FindBySubjectDistinguishedName。 | 
子元素
无。
父元素
| 元素 | 说明 | 
|---|---|
| 指定在向对等客户端进行身份验证时使用的凭据。 | 
备注
此配置元素包含对对等网格中的邻居进行身份验证时使用的 X509Certificate2 实例。
有关对等编程的更多信息,请参见Peer to Peer Networking。
示例
下面的代码指定如何查找在对等方案中使用的证书。
<behaviors>
 <endpointBehaviors>
  <behavior name="MyEndpointBehavior">
   <clientCredentials>
    <peer>
     <certificate findValue="www.contoso.com" 
                   storeLocation="LocalMachine"
                   x509FindType="FindByIssuerName" />
    </peer>
   </clientCredentials>
  </behavior>
</endpointBehaviors>
另请参见
参考
PeerCredentialElement
Certificate
X509PeerCertificateElement
Certificate
其他资源
Working with Certificates
Peer to Peer Networking
Peer Channel Message Authentication
Peer Channel Custom Authentication
Best Practices for Securing PeerChannel Applications