<scopedCertificates> 元素的 <add>

向作用域证书集合添加 X.509 证书。

configuration
  system.serviceModel
    behaviors
      endpointBehaviors
        behavior
          <clientCredentials>
            <serviceCertificate>
              <scopedCertificates>
                <add>

语法

<add findValue="String"
     storeLocation="CurrentUser/LocalMachine"
     storeName=" CurrentUser/LocalMachine"
     targetUri="string"
     x509Type="FindByThumbprint/FindBySubjectName/FindBySubjectDistinguishedName/FindByIssuerName/FindByIssuerDistinguishedName/FindBySerialNumber/FindByTimeValid/FindByTimeNotYetValid/FindBySerialNumber/FindByTimeExpired/FindByTemplateName/FindByApplicationPolicy/FindByCertificatePolicy/FindByExtension/FindByKeyUsage/FindBySubjectKeyIdentifier" />

特性和元素

以下几节描述了特性、子元素和父元素。

特性

属性 说明
targetUri 字符串。 指定与证书相关的服务的 URI。
findValue 字符串。 要搜索的值。
x509FindType 枚举。 要搜索的证书字段之一。
storeLocation 枚举。 要搜索的两个存储位置之一。
storeName 枚举。 要搜索的系统存储之一。

findValue 属性

说明
String 值取决于搜索的字段(由 X509FindType 属性指定)。 例如,如果搜索指纹,则此值必须为十六进制数字字符串。

x509FindType 属性

说明
枚举 值包括:FindByThumbprint、FindBySubjectName、FindBySubjectDistinguishedName、FindByIssuerName、FindByIssuerDistinguishedName、FindBySerialNumber、FindByTimeValid、FindByTimeNotYetValid、FindBySerialNumber、FindByTimeExpired、FindByTemplateName、FindByApplicationPolicy、FindByCertificatePolicy、FindByExtension、FindByKeyUsage 和 FindBySubjectKeyIdentifier。

storeLocation 属性

说明
枚举 CurrentUser 或 LocalMachine。

storeName 属性

说明
枚举 值包括:AddressBook、AuthRoot、CertificateAuthority、Disallowed、My、Root、TrustedPeople 和 TrustedPublisher。

子元素

无。

父元素

元素 说明
<scopedCertificates> 表示特定服务为身份验证提供的 X.509(作用域)证书的集合。

备注

此元素使客户端能够根据与它通信的服务的 URL 来配置要使用的服务证书。 这在已颁发令牌的方案中尤其有用,在这些方案中,客户端可与多个服务(终端服务以及中间的安全令牌服务)进行通信。 对于使用基于证书的消息安全的绑定,此证书用于加密发送给服务的消息,并期望服务用它来对客户端的应答进行签名。

如果绑定需要服务的证书,但在 ScopedCertificates 中未找到服务 URL 的特定证书,则使用默认证书。

有关详细信息,请参阅如何:创建联合客户端的“设定范围的证书”部分。

示例

下面的示例向集合中添加一个 X.509 证书。

<behaviors>
  <endpointBehaviors>
    <behavior name="MyEndpointBehavior">
      <clientCredentials>
        <serviceCertificate>
          <scopedCertificates>
            <add targetUri="http://www.contoso.com"
                 findValue="www.Contoso.com"
                 storeLocation="LocalMachine"
                 storeName="Root"
                 x509FindType="FindByIssuerName" />
          </scopedCertificates>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>

请参阅