Hello,
I'm trying to get simple json data from my linux SSH remote server (UWP, Android) but it refuse to respond to my App.
But i'm confused why i can get the data when i send the request with my browser(with not secure warning) or through Postman(with Settings option: SSL certificate Off) ??
I'm wonder how could i resolve this, how can i avoid certificate authority and get the data (just like in Postman), and how shall i actually have to deal with SSL certification in my HTTPS reqeust. My server support OpenSSL.
MAIN SEGMENT OF MY CODE:
HttpClient client = new HttpClient(); var response = await client.GetStringAsync("https://" + ServerApiLinkConnection); Debug.WriteLine(response);
ERROR:
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Exception: The text associated with this error code could not be found. The certificate authority is invalid or incorrect at System.Net.Http.HttpHandlerToFilter.SendAsync(HttpRequestMessage request, CancellationToken cancel) at System.Net.Http.HttpClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
Answers
Half of the problem is solved! I've figured out how to avoid SSL certification.
Now i have to deal with certification itself. What should i do?
This is not a Xamarin part issue. If you want to know how to build a ssl/tls certificate, we will easily find some approaches after searching:
https://www.entrustdatacard.com/blog/2019/march/how-to-build-an-ssl-tls-certificate
https://www.linode.com/docs/security/ssl/create-a-self-signed-tls-certificate/