问题
I am working on a Xamarin Form that need to call httpclient
to consume company's internal https REST api.
Unfortunately, it return with this error
Javax.Net.Ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
How can i resolve this?
回答1:
To bypass certification validation you can:
In Android Build options choose
HttpClient Implementation: AndroidClientHandler
SSL/TLS implementation: Default (Native TLS 1.2+)
In MainActivity.cs add this
ServicePointManager.ServerCertificateValidationCallback += (o, cert, chain, errors) => true;
In the Httpclient init change this
var httpClient = new HttpClient();
To
var httpClient = new HttpClient(new System.Net.Http.HttpClientHandler());
来源:https://stackoverflow.com/questions/56597401/how-can-i-install-certificate-for-visual-studio-emulator-for-androids-emulato