0

인증서를 사용하여 작동해야하는 wcf 서비스를 만들었습니다. 내 자체 인증서를 사용하고있는 곳에서의 테스트는 완벽하지만 CA에서 인증서를 생성하는 서버에서 인증서를 실행하려고 할 때마다 변경됩니다. CA를 사용하여 클라이언트 및 서버 인증서를 생성 한 후 서버 인증서를 "신뢰할 수있는 사용자"폴더로 내 보냈습니다. (두 인증서를 LocalMachine 디렉토리에 배치했습니다.) 또한 인증서에 필요한 모든 권한을 부여했습니다.WCF 서비스 인증서가 신뢰할 수있는 사용자 저장소에 없습니다.

X.509 인증서는 CN = XXXX 신뢰할 수있는 사람들 저장소에없는 : 나는 예외를 받고 있어요 클라이언트 프로그램을 실행하고있을 때

문제

가 나타납니다. 여기

여기 내 서버 설정

<services> 
    <service behaviorConfiguration="MyServiceBehavior" name="PoswsService"> 
    <endpoint address="http://xxxx/PoswsService.svc" binding="wsHttpBinding" bindingConfiguration="MyServiceBinding" 
     contract="IPoswsService" /> 
    <endpoint address="http://xxxx/mex" binding="mexHttpBinding" name="MetadataBinding" 
     contract="IMetadataExchange" /> 
    </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="MyServiceBehavior"> 
       <serviceCredentials> 
       <clientCertificate> 
        <authentication certificateValidationMode="PeerOrChainTrust" revocationMode="Online"/> 
       </clientCertificate> 
       <serviceCertificate findValue="xxxxxxxxxxxxxxxxxxxxx" storeLocation="LocalMachine" 
        storeName="My" x509FindType="FindBySerialNumber" /> 
       </serviceCredentials> 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="MyServiceBinding"> 
      <security> 
       <message clientCredentialType="Certificate"/> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    </system.serviceModel> 

입니다 클라이언트 설정은

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
      <binding name="WSHttpBinding_IPoswsService" 
       bypassProxyOnLocal="false" transactionFlow="false" > 
       <security mode="Message"> 
        <transport clientCredentialType="Windows" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="Certificate" negotiateServiceCredential="true" 
         algorithmSuite="Default" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://xxxx/PoswsService.svc" 
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPoswsService" 
      contract="TestService.IPoswsService" name="WSHttpBinding_IPoswsService" behaviorConfiguration="CustomBehavior"> 
      <identity> 
       <certificate encodedValue="long word" /> 
      </identity> 
     </endpoint> 
    </client> 

    <behaviors> 
    <endpointBehaviors> 
     <behavior name="CustomBehavior"> 
     <clientCredentials> 
      <clientCertificate findValue="xxxxxxxxxxxxxxxxxxx" x509FindType="FindBySerialNumber" storeLocation="CurrentUser" storeName="My"/> 
      <serviceCertificate> 
      <authentication certificateValidationMode="PeerTrust"/> 
      </serviceCertificate> 
     </clientCredentials> 
     </behavior> 
    </endpointBehaviors> 
    </behaviors> 
</system.serviceModel> 

누군가가 내 실수가 될 수있는 곳을 알고 계십니까?

답변

-1

많은 WCF 경험이 없지만 일반적으로 신뢰할 수있는 위치에 CA 인증서를 넣으려고합니다. 클라이언트는 자신의 신뢰할 수있는 위치를 가져야하며 CA 인증서도 거기에 있어야합니다. 그리고 프로덕션 서비스 인 경우 클라이언트와 서버 모두에 대해 certificateValidationMode를 "ChainTrust"로 변경해야합니다. 즉, CA 인증서에 연결된 인증서를 신뢰하게됩니다. "PeerTrust"는 신뢰하려는 실제 인증서를 신뢰 위치에 두는 것을 의미합니다. 이 page을 보면 도움이 될 것입니다.