1

我为我的自托管 WCF 服务创建了安全模式="TransportWithMessageCredential" 的 basichttpendpoint。

我的服务器配置有:

enter code here

   <system.serviceModel>    
       <bindings>
    <basicHttpBinding>
     <binding name="BasicHttpBinding_IViewerManager" maxBufferSize="655360000"                  maxReceivedMessageSize="655360000" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
    <security mode="TransportWithMessageCredential">
          <message clientCredentialType="Certificate" />
    </security>

           </binding>
     </basicHttpBinding>
    </bindings>

<services>
    <service behaviorConfiguration="SecureBehavior" name="Lumedx.ApolloLXPACS.ViewerServiceLibrary.ViewerManager">

    <endpoint name="basicHTTP" address="https://localhost:5100/ViewerService" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IViewerManager" contract="Lumedx.ApolloLXPACS.ServiceContracts.IViewerManager"/>
    <host>
     <baseAddresses>
      <add baseAddress="https://localhost:5100/ViewerService"/>
                    </baseAddresses>
                </host>
            </service>
        </services>

        <behaviors>
            <endpointBehaviors>
                <behavior name="HttpsBehavior">
                </behavior>
            </endpointBehaviors>
            <serviceBehaviors>

                <behavior name="SecureBehavior">

                    <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                    <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
                    <serviceCredentials>
                        <serviceCertificate findValue="RootCATest"
                                            storeLocation="LocalMachine"
                                            storeName="My"
                                            x509FindType="FindByIssuerName" />
                    </serviceCredentials>
                </behavior>

            </serviceBehaviors>
        </behaviors>

    </system.serviceModel>
my windows client config has:
<?xml version="1.0"?>
<configuration>

    <appSettings>
        <add key="priorityEndpoint1" value="basicHttpEndpoint"/>

        <add key="maxCommunicationRetries" value="0"/>
    </appSettings>


    <system.serviceModel>


        <bindings>

            <basicHttpBinding>
                <binding name="BasicHttpBinding_IViewerManager" maxBufferSize="655360000" maxReceivedMessageSize="655360000" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                    <security mode="TransportWithMessageCredential">
                        <message clientCredentialType="Certificate" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>

        <client>
            <endpoint name="basicHttpEndpoint" address="https://10.10.10.100:5100/ViewerService/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IViewerManager" contract="Lumedx.ApolloLXPACS.ServiceContracts.IViewerManager" behaviorConfiguration="HttpsBehavior"/>
        </client>

        <behaviors>
            <endpointBehaviors>
                <behavior name="HttpsBehavior">
                    <clientCredentials>
                        <clientCertificate findValue="RootCATest"
                                            storeLocation="LocalMachine"
                                            storeName="My"
                                            x509FindType="FindByIssuerName" />
                    </clientCredentials>
                </behavior>
            </endpointBehaviors>
        </behaviors>
    </system.serviceModel>
<

我已经安装并配置了证书。

我正在将我的 Windows 客户端与带有 https 端点的自托管 WCF 服务连接起来。我使用wireshark捕获了网络流量。我在网络流量中看到的只是服务器和客户端之间的 TCP 数据包。当我关注 TCP 流时,消息似乎没有被加密。

我在这里做错了什么?

4

1 回答 1

0

安全模式TransportWithMessageCredential对传输 (SSL) 进行加密,并且不加密消息正文。

使用您的证书进行加密。

如果您看到未加密的数据,则发生以下情况之一:

  1. 出于某种原因,流量未使用 ssl 加密
  2. Wireshark 可以访问您的证书和使用它的加密流量。

这看起来和你做的一样吗?http://trycatch.be/blogs/decaluwet/archive/2009/04/08/decrypting-ssl-traffic-using-wireshark.aspx

无论如何,如果启用了传输级加密并且您的证书没有受到损害,那么您应该是安全的。

于 2012-06-06T18:41:09.600 回答