Android Question javax.net.ssl.sslpeerUnverifiedexception

Almora

Active Member
Licensed User
javax.net.ssl.sslpeerUnverifiedexception

I get an error like that.
I researched the forum. solution;

Follow these steps:
- Uncheck HttpUtils2 library *****(okHttpUtils2)
- Add HttpUtils2 modules (from the first post)
- Check StringUtils and Http libraries
- Change hc.Initialize in HttpUtils2Service to hc.InitializeAcceptAll

but my problem is due to the library. I can't use this method. I'm not using the httpUtils2(okHttpUtils2) library.
I am using the customrss library.
Is there a solution to the certificate error when using the library?
thank you...
 

DonManfred

Expert
Licensed User
Is there a solution to the certificate error when using the library?
Yes, setup a trusted Certificate for the domain.
 
Upvote 0

Almora

Active Member
Licensed User
Yes, setup a trusted Certificate for the domain.


I can't test it right now. Does this help me?

B4X:
Sub CreateTrustAllSSLSocketFactory As JavaObject
   Dim tm As CustomTrustManager
   tm.InitializeAcceptAll
   Dim SSLContext As JavaObject
   SSLContext = SSLContext.InitializeStatic("javax.net.ssl.SSLContext").RunMethod("getInstance", Array("TLS"))
   SSLContext.RunMethod("init", Array(Null, tm, Null))
   Dim Factory As JavaObject = SSLContext.RunMethod("getSocketFactory", Null)
   Return Factory
End Sub
 
Upvote 0
Top