A website uses Let's Encrypt SSL certificate. An Android app calls an API of this website. It worked perfectly until around 20:00 2021-09-29 UTC
URL url = new URL("https://my.domain.com/Home/api/path");
HttpURLConnection huc = (HttpURLConnection) url.openConnection();
The above code starts to throw the following exception:
Unacceptable certificate: CN=R3, O=Let's Encrypt, C=US
I understand there is a planned significant change for Let's Encrypt SSL certificate: "DST Root CA X3 will expire on September 30, 2021. That means those older devices that don’t trust ISRG Root X1 will start getting certificate warnings when visiting sites that use Let’s Encrypt certificates. "
IMPORTANT:
- This exception happens on ALL Android devices, old or new.
- Web browsers (e.g., Chromes) work fine with the website.
I am wondering if anyone could offer a clue about why HttpURLConnection fails in this case? Is HttpURLConnection deprecated and should it be replaced with something else?