2011-11-23 141 views
1

问题:
我无法连接到使用的Windows7上的C#.NET中启用了TLS web服务端点。 提琴手请求和响应是:TLS在WCF客户端

请求: -

CONNECT myendpoint:9443 HTTP/1.1
主机:myendpoint:9443
代理连接:保持活动

这里的回应: -

HTTP/1.1 502连接失败
连接:关闭
时间戳:18:54:29.909

HTTPS连接失败。

* System.Net.Sockets.SocketException:
无连接可以作出,因为目标机器积极地拒绝它:9443
在Fiddler.ServerChatter.CreateConnectedSocket(ip地址[] arrDestIPs,的Int32 I端口,会议_oSession)*
*在Fiddler.Session._handleHTTPSConnect()*”

我的客户是一个.net桌面/台AP折叠。我是而不是确信我已经正确完成了客户端TLS /证书设置/配置。另外我有几个没有答案的问题。
我已完成以下操作:

我有一个“TLS已启用”的互联网Web服务端点。为了正确地沟通,我已经提供了4两件事:

1)ca.cert.pem:公共证书从CA
2)myname.cert.pem:我的公证书
3)MYNAME。 key.pem:我的私钥
4)密码:“mypassword”

我也一直给证书请求(.csr)和用于生成证书的参数。

上TLS相关的东西读了后,我想这就是我需要做的:

步骤1)使用OpenSSL的ca.cert.pem转换为.CER文件,并添加/导入以本地计算机的“受信任的根证书颁发机构”,以便CA现在可以信任。

步骤2)联合myname.cert.pem和myname.key.pem成.pkcs12做
OpenSSL的PKCS12 -export退房手续keystore.pkcs12 -in myname.cert.pem -inkey myname.key。 pem“。这需要密码,我使用“mypassword”。

步骤3)的keystore.pkcs12添加到“个人”证书(这里要求输入密码,我给“输入mypassword”)

在第三步添加的证书的指纹是“fef4ab753a11a30a6c4342e63e00f237ef0818c1”

现在,这里是我做的app.config变化:

<bindings> 
    <wsHttpBinding> 
    <binding name="My_HTTPS_Endpoint_Binding" closeTimeout="00:01:00" 
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
    maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" 
    textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
     <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
     maxBytesPerRead="4096" maxNameTableCharCount="2147483647" /> 
     <reliableSession ordered="true" inactivityTimeout="00:10:00" 
     enabled="false" /> 
     <security mode="Transport"> 
     <transport clientCredentialType="Certificate" proxyCredentialType="None" 
     realm="" /> 
     <message clientCredentialType="Windows" negotiateServiceCredential="true" 
     establishSecurityContext="true" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

<client> 
    <endpoint address="https://myendpoint:9443/myService" 
    binding="wsHttpBinding" bindingConfiguration="My_HTTPS_Endpoint_Binding" 
    contract="MyNs.myClass" name="My_HTTPS_Endpoint" behaviorConfiguration="clientBehaviour" /> 
</client> 

<behaviors> 
    <endpointBehaviors> 
    <behavior name="clientBehaviour"> 
     <clientCredentials> 
     <clientCertificate findValue="fef4ab753a11a30a6c4342e63e00f237ef0818c1" 
    storeLocation="LocalMachine" 
    storeName="My" 
    x509FindType="FindByThumbprint" /> 

     </clientCredentials> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 

所以它似乎我已经错过任何关键的一步?我有一些知识空白:

1)我的理解是我的公共和私人组合键只用于从服务器到客户端的通信。客户端到服务器的消息加密如何工作?我的客户从哪里获取需要用于消息加密的服务器的公钥?

2)密码是否需要在配置中提供?只是猜测..

+1

忙于XDS? :-) – kroonwijk

+0

@kroonwijk是:) – mishal153

回答

0

问题原来,目的地端口配置是越野车,他们现在修复它。该端口无法访问