Android Question httpjob workes no more with https

birnesoft

Active Member
Licensed User
since I've changed to targetSdkVersion 28
I have this error :

ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not fou

B4X:
Sub Globals
    Dim j As HttpJob
End Sub

Sub Activity_Create(FirstTime As Boolean)
    j.Initialize("j",Me)
    j.Download("https://abc.de/qorddsd.jpg")
End Sub

Sub JobDone (Job As HttpJob)
Log (Job.JobName)
End Sub
 

DonManfred

Expert
Licensed User
1. The url points to a 404 error.
2. Using the domain alone did worked for me. I used b4j to check it though.
3. I tried it on my Android 9 device using targetsdk 28 and it works fine with
B4X:
    Dim j1 As HttpJob
    j1.Initialize("", Me)
    j1.Download("https://abc.de/")
    Wait For (j1) JobDone(j As HttpJob)
    If j.Success Then
        Dim res As String = j.GetString
        Log(res)
        'Log($"Clean:"$)
    Else
        Log(j.ErrorMessage)
    End If
    j.Release
4. I tried it with my Android 10 device using targetsdk 28. Works fine too.
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
If the url you provided above was mocked up and not real (ABCDE for privacy reasons) and that's why @DonManfred got a 404, then just make sure you are using okhttputils2 lib - because if you are using a different/older lib for the httpjob, it may be using old root certificates that are not compatible with the SSL certificate of the site you are trying to connect to.
 
Last edited:
Upvote 0

birnesoft

Active Member
Licensed User
I use Android 9
b4A 9.8
Jdk 9.04

sorry "https://abc.de" was only an placeholder. I think the problem is from the server. But before it works since years.

B4X:
Dim j1 As HttpJob
    j1.Initialize("", Me)
    j1.Download("https://evoloo.de/chatpic/qoruooaejhvjtrgctgppbbvvnulstiehsuhnavhk.jpg")
    Wait For (j1) JobDone(j As HttpJob)
    If j.Success Then
        Dim res As String = j.GetString
        Log(res)
        'Log($"Clean:"$)
    Else
        Log(j.ErrorMessage)
    End If
    j.Release
 
Upvote 0

JohnC

Expert
Licensed User
Maybe by switching to targetSdkVersion28, it wont allow TLS 1.0 and is forcing SSL connections to use TLS version 1.1 or higher (because TLS 1.0 was deprecated in 2018 as Erel inidicated) and maybe the server you are trying to connect to only supports TLS 1.0.

You can go to this website and enter the server address and see if it supports TLS 1.1 or 1.2:

 
Last edited:
Upvote 0
Top