0

インターネット経由で Web サービスを設計するために WCF を使用しようとしています。要件は、TLS (Transport Layer Security) と MLS (Message Layer Security) を提供する必要があることです。この目的のために、「ws2007HttpBinding」をセキュリティ モードを「TransportWithMessageCredential」として使用しています。ここでは、リクエストが SSL 経由で転送されていることがわかりましたが、Fiddler (https 用) を使用すると、soap 本体がクリア テキスト形式であることがわかりました。

トランスポート レベルのセキュリティでは ClientCredentialType を「None」として使用し、メッセージ レベルのセキュリティでは ClientCredentialType として「Certificate」を使用しました。

.net フレームワーク 3.5 を使用しています。

参考までに、SSLとサーバーに別の証明書を使用しています。

サーバーの Web.config は次のとおりです。

<system.serviceModel>
    <services>
        <service behaviorConfiguration="API_WCF.Service1Behavior" name="API_WCF.API">
            <endpoint address="https://localhost/API_WCF/API.svc" name="API" binding="ws2007HttpBinding" bindingConfiguration="customWsHttpBinding" contract="API_WCF.IARDAPI">
                <identity>
                    <dns />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        </service>
    </services>
    <bindings>
        <ws2007HttpBinding>
            <binding name="customWsHttpBinding">
      <!-- For http  -->
      <!--
      <security mode="Message">
        <message clientCredentialType="Certificate" negotiateServiceCredential="false" establishSecurityContext="false"/>
      </security>
      -->
      <!-- For https  -->
        <security mode="TransportWithMessageCredential">
        <transport clientCredentialType="None"/>
                    <message clientCredentialType="Certificate" negotiateServiceCredential="false" establishSecurityContext="false"/>
                </security>
            </binding>
        </ws2007HttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="API_WCF.Service1Behavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://localhost/API_WCF/API.svc/API"/>
                <serviceCredentials>
                    <serviceCertificate findValue="CN=WSE2QuickStartServer" storeLocation="LocalMachine" x509FindType="FindBySubjectDistinguishedName" storeName="My"/>
                    <clientCertificate>
                        <authentication certificateValidationMode="ChainTrust" revocationMode="NoCheck"/>
                    </clientCertificate>
                </serviceCredentials>

                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="true"/>

            </behavior>
        </serviceBehaviors>
    </behaviors>
    <diagnostics wmiProviderEnabled="true" performanceCounters="ServiceOnly">
        <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000"/>
    </diagnostics>
</system.serviceModel>

WCF over Internetでトランスポート層セキュリティを使用してメッセージレベルのセキュリティを実現する方法を親切にガイドしてください。

4

2 に答える 2

0

SSL とメッセージ レベルの暗号化 (単なるメッセージ レベル認証ではなく) が必要な場合は、カスタム バインディングを使用する必要があります。例(実際の構成は、必要なものによって異なります):

<textMessageEncoding messageVersion="Soap11" />
<security authenticationMode="MutualCertificate" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"></security>
<httpsTransport />
于 2013-04-15T09:24:35.137 に答える