![](/img/trans.png)
[英]WCF Service TransportWithMessageCredentials Customer validator
[英]Service certificate and transportwithmessagecredentials in wcf
我有一個WCF服務,我想使用我可以正確實現的客戶端證書進行身份驗證。我的困惑是正確保護數據,因此即使有人攔截也無法解密它。該服務運行在https上,我正在使用以下web.config客戶端可以是任何本地工作進程或Web表單,也可以是任何東西。因此,問題在於下面的設置是確保其安全的正確方法。
在客戶端,我將服務證書配置為clientChannelservice.ClientCredentials.ServiceCertificate.DefaultCertificate = GetServiceCertificate();
但是即使我提供或不提供此服務證書也沒有什么不同。Jo只是想知道我是否正確保護了我的服務,因為當我將數據寫入日志時,我看到返回值未編碼並且是這樣傳輸的,是因為它受SSL或其他保護。如果有人可以清除我的困惑。
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<services>
<service behaviorConfiguration="customBehavior" name="CertProtectedWCF.Service1">
<endpoint
address="https://localhost:123/Service1.svc"
binding="wsHttpBinding"
bindingConfiguration="customWsHttpBinding"
contract="CertProtectedWCF.IService1" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="customWsHttpBinding">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="customBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<clientCertificate>
<authentication
certificateValidationMode="PeerTrust"
revocationMode="NoCheck" />
</clientCertificate>
<serviceCertificate
findValue="ACS2SigningCertificate"
x509FindType="FindBySubjectName"
storeLocation="LocalMachine"
storeName="My" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
</system.serviceModel>
客戶端獲取服務器證書作為SSL協議的一部分。 使用自簽名證書,客戶端無法使用CA鏈來驗證自己是否獲得了正確的東西。 但是它當然可以使用該證書解密...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.