-
Notifications
You must be signed in to change notification settings - Fork 92
Integration
Florian Schmaus edited this page Nov 23, 2013
·
3 revisions
It consists of three easy steps:
... android.library.reference.1=../MemorizingTrustManager
... <activity android:name="de.duenndns.ssl.MemorizingActivity" /> </application> </manifest>
Hooking MemorizingTrustmanager in HTTPS connections:
// register MemorizingTrustManager for HTTPS SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, MemorizingTrustManager.getInstanceList(this), new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
Or, for aSmack you can use setCustomSSLContext()
org.jivesoftware.smack.ConnectionConfiguration connectionConfiguration = … SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, MemorizingTrustManager.getInstanceList(application), new java.security.SecureRandom()); connectionConfiguration.setCustomSSLContext(sc);