Android Question httpclient initialize accept all not working

Nickelgrass

Active Member
Licensed User
Longtime User
Hi,
I am using the PushExample to register the device on a webserver (HTTPS). I added the httputils2 as modules, unchecked the library and changed the hc.initialize to hc.initializeacceptall. So it should work.
But I still get the same error: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate . What is going on here? What could still be wrong?
Thanks!
 

Shay

Well-Known Member
Licensed User
Longtime User
I am not using HttpClient I am using HttpUtils2 (with POST)
Do I need to switch from HttpUtils to HttpClient? (Is it supporting POST?)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
@Shay you will need to download HttpUtils2 source code and change hc.Initialize to hc.InitializeAcceptAll.

Is it foreseeable if this will get supported soon?
The underlying API doesn't support SNI so it is not a simple fix. It requires creating a completely new http client library. Currently the only missing feature is SNI. It will probably not happen in the near future.
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Erel, is there a Httutils2 class here (I cannot find)
I don't know to compile this, if you compile I can test it
 
Last edited:
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I am not sure I understand what you mean.
Do you mean I need to add the HTTP library and then add:
hc.InitializeAcceptAll("hc")
if so, don't I need to use hc to post my query? (instead of HttpJob)
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I did what you wrote, still not working
I used this: https://www.b4x.com/android/forum/t...-services-are-now-even-simpler.18992/#content
and changed:
B4X:
Sub Service_Create
    TempFolder = File.DirInternalCache
'    hc.Initialize("hc")
    hc.InitializeAcceptAll("hc")
    TaskIdToJob.Initialize
End Sub

I tested it on my web site, started by changing job3 to download jpg from my website using http - was ok
then changed to https and it did not work
Error: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate

I can provide you the web site link on PM if you want to test it

but this is problematic, since most of web sites including Amazon EC2 are using SNI
and for private certificate it will cost 600$ per month
and I cannot use clear GET / RESPONSE since all my data is readable
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
why not encrypt it on the serverside and decrypt on the device?

it doesn't have to be something fancy as long as it is not readable with a sniffer.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…