Android Question HttpJob ignore certificate

TheRealMatze

Active Member
Licensed User
Hello again,

short before starting to port to ios i have some old devices to test - without success...
This time a samsung galaxy s2 and s4 active. Not the most present phones here, but some have phones like this (and that´s why i have them too ;))
It looks like this devices can´t verify my "Let´s Encrypt"-certificates. I dont see much options.
Option A - use http instead of https. Yes... no ;)
Option B - ignore certificate errors. not much better, but a little bit. When i do this on the server with the option 13056 in Msxml2.ServerXMLHTTP. Is this possible with the HttpJob?

Regards

Btw.: A solution working also with ios is preferred

B4X:
Logger verbunden mit:  samsung GT-I9105P
--------- beginning of /dev/log/main
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:
httpjob_getstring2 (java line: 294)
java.io.FileNotFoundException: /data/data/vsoft.sedatacollector/cache/1: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:416)
    at java.io.FileInputStream.<init>(FileInputStream.java:78)
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:215)
    at vsoft.sedatacollector.httpjob._getstring2(httpjob.java:294)
    at vsoft.sedatacollector.httpjob._getstring(httpjob.java:283)
    at vsoft.sedatacollector.login$ResumableSub_btnlogin_Click.resume(login.java:454)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207)
    at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1178)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5283)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    at libcore.io.IoBridge.open(IoBridge.java:400)
    ... 17 more
--------- beginning of /dev/log/system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (login) Create, isFirst = true **
** Activity (login) Resume **
** Activity (login) Pause, UserClosed = false **
Copying updated assets files (30)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (login) Create, isFirst = true **
** Activity (login) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:
Error occurred on line: 292 (HttpJob)
java.io.FileNotFoundException: /data/data/vsoft.sedatacollector/cache/1: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:416)
    at java.io.FileInputStream.<init>(FileInputStream.java:78)
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:215)
    at vsoft.sedatacollector.httpjob._getstring2(httpjob.java:482)
    at vsoft.sedatacollector.httpjob._getstring(httpjob.java:136)
    at vsoft.sedatacollector.login$ResumableSub_btnlogin_Click.resume(login.java:486)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
    at anywheresoftware.b4a.BA$2.run(BA.java:387)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5283)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    at libcore.io.IoBridge.open(IoBridge.java:400)
    ... 28 more
 

TheRealMatze

Active Member
Licensed User
The real error here is that you are not checking that Job.Success = True.
You are absolutely right Erel! The accept-all-option works fine, but they are more errors on the real devices... i´m a little bit confused why they are no errors on the emulator... but i put it in another thread, because it´s not related.
 
Upvote 0
Top