WCF证书链信任身份验证:"调用方未经过服务验证."

And*_*Dog 6 wcf ws-security certificate wcf-security

我想在与WCF服务通信时使用基于证书的加密和验证.因此,我创建了测试证书,"TempCA"作为我的根CA,"SignedByCA"作为由CA签署的客户端证书.

当我将客户端证书放入"本地计算机\受信任的人"并使用时certificateValidationMode="PeerTrust",该服务识别客户端,一切都按预期工作.但是使用信任链验证(certificateValidationMode="ChainTrust"),我遇到了错误"调用者未被服务验证".

相关的服务器端配置:

<behaviors>
      <serviceBehaviors>
        <behavior name="customServiceBehavior">
            [...]
            <serviceCredentials>
                <clientCertificate>
                    <authentication certificateValidationMode="ChainTrust" trustedStoreLocation="LocalMachine" mapClientCertificateToWindowsAccount="false"  />
                </clientCertificate>
                <serviceCertificate findValue="TempCA"
                                    storeLocation="LocalMachine"
                                    storeName="My"
                                    x509FindType="FindBySubjectName" />
            </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
        <wsHttpBinding>
            <binding name="soapBindingConfiguration">
                <security mode="Message">
                    <message clientCredentialType="Certificate" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
Run Code Online (Sandbox Code Playgroud)

相关客户端配置(其余由"添加服务引用"自动创建):

<endpointBehaviors>
    <behavior name="customClientBehavior">
        <clientCredentials>
            <clientCertificate findValue="SignedByCA" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
        </clientCredentials>
    </behavior>
</endpointBehaviors>
Run Code Online (Sandbox Code Playgroud)

客户端和服务器证书都与其私钥一起存储在"本地计算机\个人"中(因为我在台计算机上进行测试),"TempCA"(我的根证书)也在"本地计算机\受信任的根证书颁发机构"中".

我在这里错过了什么?任何工作的例子?

And*_*Dog 5

我终于找到了问题所在.必须禁用撤销检查.我的测试CA显然没有关联的CRL,因此在这种情况下,WCF似乎阻止了每个客户端,因为它无法验证.

<clientCertificate>
    <authentication certificateValidationMode="ChainTrust"
                    revocationMode="NoCheck" ???????????????????????????????
                    [...]  />
</clientCertificate>
Run Code Online (Sandbox Code Playgroud)