I'm trying to make an SSL call using HTTPWebRequest
and its continually failing saying it can't establish trust. I've added a callback to ServicePointManager.ServerCertificateValidationCallback
and returning true
always works. However, I'd like things to be a little more secure than that. Looking at the SslPolicyErrors
in the validation method it appears that I'm getting a RemoteCertificateNameMismatch
error. What isn't matching up correctly to cause this kind of error?
(edit: see comments in the answer) The site I'm accessing uses HTTPBasic over SSL and an URL something like v1.api.serviceprovider.com, with a certificate issued to *.serviceprovider.com.