Android Question Disable SSL-Checking

W. Graf

Member
Licensed User
Longtime User
Dear all,

sorry for posting to an old thread, but it's a similar issue / question.

I'm having a problem with Download() from the OkHttpUtils2-Library when using https-URLs.

My source code:

B4X:
 Dim Job1 As HttpJob
 Job1.Initialize("", Me)
 Job1.Download("https://example.domain.at/apiservice/abc")

 Wait For (Job1) JobDone (Job1 As HttpJob)
 If Job1.Success = False Then
  Log(Job1.ErrorMessage)
 End If


If I start it, then I'm getting the following error message:
'javax.net.ssl.SSLPeerUnverifiedException: Hostname example.domain.at not verified:
certificate: sha256/gtO3xpQaaf2vS70u3NGju9NdasY64ajUcvCM8Gtmtk=
DN: 1.2.840.113549.1.9.1=#1612616e64726f6964406369747269782e636f6d,CN=127.0.0.1,OU=XXXXXX,O=CCCCCC,L=FFFFF,ST=Florida,C=US
subjectAltNames: []'

If I try to contact a http-service, then everything works fine.


I read some articles (like this) with similar Problems, for example:
https://www.b4x.com/android/forum/threads/ssl-connection-to-a-webserver.66193/#post-418928
https://www.b4x.com/android/forum/threads/disable-ssl-certificate-check.75243/
The articles refer to:
https://www.b4x.com/android/forum/t...putils2-httputils2-source-code.82632/#content

I could find the advice, to use hc.InitializeAcceptAll.
But then I have to rewrite my code (without using Wait For, for example), because I couldn't find HttpJob.InitializeAcceptAll(). Am I right?

Thank you very much!
BR Wolfgang
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
But then I have to rewrite my code (without using Wait For, for example), because I couldn't find HttpJob.InitializeAcceptAll(). Am I right?
No.

Use the source version of okhttputils2.
In the service create of the kttputils service: change hc.initialize to hc.initializeacceptall
Use the sourceversion instead of the library
 
Upvote 0
Top