Search in sources :

Example 1 with SignalServiceTrustStore

use of org.thoughtcrime.securesms.push.SignalServiceTrustStore in project Signal-Android by signalapp.

the class BadgeLoader method createFactory.

public static Factory createFactory() {
    try {
        OkHttpClient baseClient = ApplicationDependencies.getOkHttpClient();
        SSLContext sslContext = SSLContext.getInstance("TLS");
        TrustStore trustStore = new SignalServiceTrustStore(ApplicationDependencies.getApplication());
        TrustManager[] trustManagers = BlacklistingTrustManager.createFor(trustStore);
        sslContext.init(null, trustManagers, null);
        OkHttpClient client = baseClient.newBuilder().sslSocketFactory(new Tls12SocketFactory(sslContext.getSocketFactory()), (X509TrustManager) trustManagers[0]).connectionSpecs(Util.immutableList(ConnectionSpec.RESTRICTED_TLS)).build();
        return new Factory(client);
    } catch (NoSuchAlgorithmException | KeyManagementException e) {
        throw new AssertionError(e);
    }
}
Also used : OkHttpClient(okhttp3.OkHttpClient) MultiModelLoaderFactory(com.bumptech.glide.load.model.MultiModelLoaderFactory) Tls12SocketFactory(org.whispersystems.signalservice.api.util.Tls12SocketFactory) ModelLoaderFactory(com.bumptech.glide.load.model.ModelLoaderFactory) SSLContext(javax.net.ssl.SSLContext) SignalServiceTrustStore(org.thoughtcrime.securesms.push.SignalServiceTrustStore) TrustStore(org.whispersystems.signalservice.api.push.TrustStore) Tls12SocketFactory(org.whispersystems.signalservice.api.util.Tls12SocketFactory) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SignalServiceTrustStore(org.thoughtcrime.securesms.push.SignalServiceTrustStore) KeyManagementException(java.security.KeyManagementException) TrustManager(javax.net.ssl.TrustManager) X509TrustManager(javax.net.ssl.X509TrustManager) BlacklistingTrustManager(org.whispersystems.signalservice.internal.util.BlacklistingTrustManager)

Example 2 with SignalServiceTrustStore

use of org.thoughtcrime.securesms.push.SignalServiceTrustStore in project Signal-Android by WhisperSystems.

the class BadgeLoader method createFactory.

public static Factory createFactory() {
    try {
        OkHttpClient baseClient = ApplicationDependencies.getOkHttpClient();
        SSLContext sslContext = SSLContext.getInstance("TLS");
        TrustStore trustStore = new SignalServiceTrustStore(ApplicationDependencies.getApplication());
        TrustManager[] trustManagers = BlacklistingTrustManager.createFor(trustStore);
        sslContext.init(null, trustManagers, null);
        OkHttpClient client = baseClient.newBuilder().sslSocketFactory(new Tls12SocketFactory(sslContext.getSocketFactory()), (X509TrustManager) trustManagers[0]).connectionSpecs(Util.immutableList(ConnectionSpec.RESTRICTED_TLS)).build();
        return new Factory(client);
    } catch (NoSuchAlgorithmException | KeyManagementException e) {
        throw new AssertionError(e);
    }
}
Also used : OkHttpClient(okhttp3.OkHttpClient) MultiModelLoaderFactory(com.bumptech.glide.load.model.MultiModelLoaderFactory) Tls12SocketFactory(org.whispersystems.signalservice.api.util.Tls12SocketFactory) ModelLoaderFactory(com.bumptech.glide.load.model.ModelLoaderFactory) SSLContext(javax.net.ssl.SSLContext) SignalServiceTrustStore(org.thoughtcrime.securesms.push.SignalServiceTrustStore) TrustStore(org.whispersystems.signalservice.api.push.TrustStore) Tls12SocketFactory(org.whispersystems.signalservice.api.util.Tls12SocketFactory) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SignalServiceTrustStore(org.thoughtcrime.securesms.push.SignalServiceTrustStore) KeyManagementException(java.security.KeyManagementException) TrustManager(javax.net.ssl.TrustManager) X509TrustManager(javax.net.ssl.X509TrustManager) BlacklistingTrustManager(org.whispersystems.signalservice.internal.util.BlacklistingTrustManager)

Aggregations

ModelLoaderFactory (com.bumptech.glide.load.model.ModelLoaderFactory)2 MultiModelLoaderFactory (com.bumptech.glide.load.model.MultiModelLoaderFactory)2 KeyManagementException (java.security.KeyManagementException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 SSLContext (javax.net.ssl.SSLContext)2 TrustManager (javax.net.ssl.TrustManager)2 X509TrustManager (javax.net.ssl.X509TrustManager)2 OkHttpClient (okhttp3.OkHttpClient)2 SignalServiceTrustStore (org.thoughtcrime.securesms.push.SignalServiceTrustStore)2 TrustStore (org.whispersystems.signalservice.api.push.TrustStore)2 Tls12SocketFactory (org.whispersystems.signalservice.api.util.Tls12SocketFactory)2 BlacklistingTrustManager (org.whispersystems.signalservice.internal.util.BlacklistingTrustManager)2