Partager via


<certificate> Element

Specifies an X.509 certificate to use for signing and encrypting messages for peer-to-peer clients.

For more information about peer-to-peer programming, see Peer to Peer Networking.

<system.serviceModel>

  <behaviors>

    <endpointBehaviors>

      <behavior> of <endpointBehaviors>

        <clientCredentials>

          <peer> of <clientCredentials> Element

                                    
                                    <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"
                                
                                    
                                    />
                                

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

customCertificateValidator

Optional string. A type and assembly used to validate a custom type. This attribute must be set when certificateValidationMode is set to Custom.

certifcateValidationMode

Optional enumeration. Specifies one of three modes used to validate credentials. If set to Custom, then a customCertificateValidator must also be supplied. The default is ChainTrust.

customCertificateValidatorType Attribute

Value Description

String

Specifies the type name and assembly and other data used to find the type. At minimum, a namespace and type name are required. Optional information includes: assembly name, version number, culture, and public key token.

certificateValidationMode Attribute


Value Description

Enumeration

One of the following values: None, PeerTrust, ChainTrust, PeerOrChainTrust, Custom. The default is ChainTrust.

For more information, see Working with Certificates.

Child Elements

None.

Parent Elements

Element Description

<peer> of <clientCredentials> Element

Specifies credentials used when authenticating peer-to-peer clients.

Remarks

Example

The following code specifies how to find the certificate used in a peer-to-peer scenario.

<behaviors>
 <endpointBehaviors>
  <behavior name="MyEndpointBehavior">
   <clientCredentials>
    <peer>
     <certificate findValue="www.contoso.com" 
                   storeLocation="LocalMachine"
                   x509FindType="FindByIssuerName" />
    </peer>
   </clientCredentials>
  </behavior>
</endpointBehaviors>

Footer image

Send comments about this topic to Microsoft.
© Microsoft Corporation. All rights reserved.