I am attempting to use the RestSharp library to call a REST API. RestSharp uses HttpWebRequest under the covers. Calling the API works fine when using HTTP, however I need to use the HTTPS protocol when calling the API. The API server has a valid certificate that is trusted in all browsers.
When I attempt to use the HTTPS protocol to call the API, I get a
TlsException
with the message "Invalid certificate received from server. Error code: 0xffffffff800b010a
"
The solutions I have found to solve this problem involve setting a callback on ServicePointManager.ServerCertificateValidationCallback
that always returns true. This is unacceptable in production as it introduces a security vulnerability.
I understand that Mono doesn't have any root certificates contained in it's Trust Store by default (http://www.mono-project.com/docs/faq/security). It is possible to import the root certificates used by Mozilla products into the Trust Store by using the mozroots command, however it seems that the implementation of Mono that ships with Unity is missing this tool. Can Unity actually use certificates contained in a Trust Store?