Xamarin的.x509证书和ClientBase

本文关键字:ClientBase 证书 x509 Xamarin | 更新日期: 2023-09-27 18:09:44

我正在工作的xamarin应用程序与web服务。

Xamarin是否支持System.ServiceModel.ClientBase中的X509Certificate ?

使用。net 4.5构建项目的下一个代码:

public void Initialize()
    {
        var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
        binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
        var endpoint = new EndpointAddress("https://ThereIsMyServerAddress/PathToService");
        _mobileService = new ServiceClient(binding, endpoint);
        _mobileService.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2("Ivanov_Ivan_Ivanovich.cer");
    }

但是Xamarin没有看到ClientCertificate。ClientCredentials中的Certificate .

是否有办法向ServiceClient添加证书?

Xamarin的.x509证书和ClientBase

它必须作为一个依赖来完成,而不是通过PCL,请参阅https://forums.xamarin.com/discussion/comment/271718#Comment_271718