Force HttpClient to trust single Certificate

前端 未结 3 1436
醉酒成梦
醉酒成梦 2020-12-28 08:56

Can you force HttpClient to only trust a single certificate?

I know you can do:

WebRequestHandler handler = new WebRequestHandler();
X509Certificate2         


        
3条回答
  •  梦毁少年i
    2020-12-28 09:32

    For anyone who comes across this in the future tou should be aware that some certificate authorities will no longer reissue certificates with the same public key when the certificate is renewed. We had this problem specifically with Globalsign who left us with the very difficult logistical problem of updating the client software with new public key pinning details for all our customers in a very short space of time, despite their published policy documents saying that they provided the option to reuse the public key. If this may be an issue for you confirm your certificate provider's policy in advance, and don't use Globalsign!

提交回复
热议问题