trying to access https://localhost:5000/ that has my own self signed certificate through android studio (with kotlin), and I keep getting the error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
Ive made the certificate using openssl through a guide i found here using method 2
I have tried adding an network_security_config.xml file that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config>
<domain includeSubdomains="true">https://10.0.2.2:5000/</domain>
<trust-anchors>
<certificates src="@raw/my_ca"/>
<certificates src="user"/>
<certificates src="system"/>
</trust-anchors>
</domain-config>
</network-security-config>
and I have made inside of res a folder called raw and put inside of it my_ca.pem, (which i converted from crt using openssl x509 -in server.crt -out server.pem -outform PEM
and renamed to my_ca.pem)
I also tried adding that certificate on the android studio settings, or allowing all untrusted sites, the code to the html request is as simple as i found:
URL("https://10.0.2.2:5000/").readText()
, it is inside an AsyncTask class, but all the class does is this request
Im accessing 10.0.2.2 and not 127.0.0.1 because from what i understood, its the way to access the local mchine through te emulator, and the erver code is a very simple python-flask code that returns a simple string