如何在app.config中配置Digicert CNG证书
我们正在尝试配置由Digicert CA发行的客户提供的证书,以在WCF服务中进行身份验证。
不幸的是,我们需要运行的实用程序无法解析证书并给出意外错误:指定的提供商类型无效。
错误。
似乎错误意味着证书的格式是CNG而不是CAPI,显然.NET 4及更高版本应该能够接受这些。但是我们仍然不确定如何将其输入app.config以使.NET识别证书。以下是带有端点证书身份验证的app.config文件内容。
有人可以提供一些建议吗?先感谢您。
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<clientCredentials>
<clientCertificate findValue="2449997a30a8c9df29bd43c1eaa91cb47d89b0cb" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
<serviceCertificate>
<authentication certificateValidationMode="None" revocationMode="NoCheck"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint name="Download" address="http://mywebserviceurl.com/MobileService/WebService2.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="TheWsHttpBinding" contract="MyApp.FileClient.IDownloadService">
<identity>
<certificate encodedValue="*****"/>
</identity>
</endpoint>
</client>
<bindings>
<wsHttpBinding>
<binding name="TheWsHttpBinding">
<security>
<message clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
we're trying to configure a client-provided certificate which was issued by the DigiCert CA for authentication in a WCF service.
Unfortunately, the utility we need to run isn't able to parse the certificate and gives a Unexpected error: Invalid provider type specified.
error.
It seems the error means that the format of the certificate is CNG instead of CAPI, and apparently .NET 4 and higher should be able to accept those. But we're still not sure how to enter that into app.config to make .NET recognize the certificate. Below is the app.config file contents with the endpoint certificate authentication.
Could someone please offer some advice? Thank you in advance.
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<clientCredentials>
<clientCertificate findValue="2449997a30a8c9df29bd43c1eaa91cb47d89b0cb" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
<serviceCertificate>
<authentication certificateValidationMode="None" revocationMode="NoCheck"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint name="Download" address="http://mywebserviceurl.com/MobileService/WebService2.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="TheWsHttpBinding" contract="MyApp.FileClient.IDownloadService">
<identity>
<certificate encodedValue="*****"/>
</identity>
</endpoint>
</client>
<bindings>
<wsHttpBinding>
<binding name="TheWsHttpBinding">
<security>
<message clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能正在使用.NET Framework 4.6.1或以下:
Possibly you are using .NET Framework 4.6.1 or below: