I have an android app that connects to HelioHost. My app runs fine on the emulator (API 33) but when I run it on a real device (API 22) I get the following exception:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
Here is the code that produces the exception:
protected String doInBackground(String... strings) {
String username = strings[0];
String activationKey = strings[1];
InputStream inStream = null;
String response = null;
try {
ContentValues values=new ContentValues();
values.put("username", username);
values.put("activationKey", activationKey);
URL url = new URL("https://zelda82.heliohost.org/activation.php");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
writer.write(getQuery(values));
writer.flush();
writer.close();
os.close();
BufferedReader reader = new BufferedReader(new InputStreamReader((conn.getInputStream())));
response = reader.readLine();
reader.close();
}
catch(Exception e) {
e.printStackTrace();
}
return response;
}
I didn’t have this problem before them doing a maintenance. Is it possible that there is a server misconfiguration?
>Solution :
when I run it on a real device (API 22) I get the following exception
That device is about 10 years old. Only around 1% of Android devices in use are that old.
The operators of that Web site do not expect anyone to use an Android device that is that old. They use Let’s Encrypt for a free SSL certificate, and Let’s Encrypt only supports Android 7.0 and higher.