代码之家  ›  专栏  ›  技术社区  ›  Daniel Gee

TLS 1.2错误-未提供客户端证书。在客户端凭据中指定客户端证书

  •  0
  • Daniel Gee  · 技术社区  · 7 年前

    我们有一个提供商最近已更改为TLS 1.2

    与此服务的通信是通过用vb.net编写的Web应用程序完成的。

    用于处理以前的安全协议的代码。根据上的回答 WCF error The client certificate is not provided. Specify a client certificate in ClientCredentials ,我已经更新了代码,但是现在我收到一条错误消息:

    The client certificate is not provided. Specify a client certificate in ClientCredentials.
    

    我需要安装一个证书才能使此代码正常工作吗?如果需要,我该怎么做?

    Dim binding = New BasicHttpBinding()
    binding.Name = "SoapBinding"
    
    binding.Security.Mode = BasicHttpSecurityMode.Transport
    
    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate
    binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None
    binding.Security.Transport.Realm = ""
    binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate
    
    Dim NewEndPoint As New EndpointAddress("www.example.com")
    
    Dim _sr As New srT.ConsumerSoapClient(binding, NewEndPoint)
    
    Dim NewSendData As New srT.SomeService
    
    Dim _result As New srT.SomeServiceRepsonse
    
    _result = _sr.ProcessRequest(NewSendData)
    

    上面的代码在vb.net中,但我假设答案在c中类似(或相同)。

    谢谢!

    1 回复  |  直到 7 年前
        1
  •  0
  •   Daniel Gee    7 年前

    我更改了以下代码,然后不需要证书(使用.NET 4.6.1):

    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.**None**