Info Call to SSL/TLS API

Description

List of all files shipped in the application.

Recommendation

This entry is informative, no recommendations applicable.

References
Technical details

Method com.upi.hcesdk.mpp.MppHostAdaptor.getServiceSecured() calling method okhttp3.OkHttpClient$Builder.hostnameVerifier()


    private com.upi.hcesdk.mpp.MppHostService getServiceSecured()
    {
        okhttp3.OkHttpClient v0_0 = 0;
        try {
            String v1_12 = javax.net.ssl.SSLContext.getInstance("TLS");
            String v2_10 = javax.net.ssl.TrustManagerFactory.getInstance(javax.net.ssl.TrustManagerFactory.getDefaultAlgorithm());
            v2_10.init(this.getKeyStore());
            javax.net.ssl.KeyManagerFactory.getInstance(javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm()).init(this.keyStore, 0);
            v1_12.init(0, v2_10.getTrustManagers(), 0);
            String v2_4 = v2_10.getTrustManagers();
        } catch (Exception) {
            if (this.service == null) {
                if (this.restAdapter == null) {
                    this.restAdapter = new retrofit.RestAdapter$Builder().setEndpoint(this.getHostURL()).setLogLevel(retrofit.RestAdapter$LogLevel.BASIC).setClient(new com.a.a.a(v0_0)).build();
                    this.service = ((com.upi.hcesdk.mpp.MppHostService) this.restAdapter.create(com.upi.hcesdk.mpp.MppHostService));
                }
            }
            return this.service;
        }
        if ((v2_4.length != 1) || (!(v2_4[0] instanceof javax.net.ssl.X509TrustManager))) {
            StringBuilder v3_6 = new StringBuilder();
            v3_6.append("Unexpected default trust managers:");
            v3_6.append(java.util.Arrays.toString(v2_4));
            throw new IllegalStateException(v3_6.toString());
        } else {
            String v2_8 = ((javax.net.ssl.X509TrustManager) v2_4[0]);
            okhttp3.OkHttpClient$Builder v5_6 = new okhttp3.OkHttpClient$Builder().connectTimeout(60, java.util.concurrent.TimeUnit.SECONDS).writeTimeout(60, java.util.concurrent.TimeUnit.SECONDS).readTimeout(60, java.util.concurrent.TimeUnit.SECONDS);
            if ((android.os.Build$VERSION.SDK_INT < 16) || (android.os.Build$VERSION.SDK_INT >= 22)) {
                v5_6.sslSocketFactory(v1_12.getSocketFactory(), v2_8);
            } else {
                try {
                    v5_6.sslSocketFactory(new com.upi.hcesdk.mpp.Tls12SocketFactory(v1_12.getSocketFactory()), v2_8);
                    String v1_17 = new okhttp3.ConnectionSpec$Builder(okhttp3.ConnectionSpec.MODERN_TLS);
                    String v2_13 = new okhttp3.TlsVersion[2];
                    v2_13[0] = okhttp3.TlsVersion.TLS_1_2;
                    v2_13[1] = okhttp3.TlsVersion.TLS_1_1;
                    String v1_19 = v1_17.tlsVersions(v2_13).build();
                    String v2_15 = new java.util.ArrayList();
                    v2_15.add(v1_19);
                    v2_15.add(okhttp3.ConnectionSpec.COMPATIBLE_TLS);
                    v2_15.add(okhttp3.ConnectionSpec.CLEARTEXT);
                    v5_6.connectionSpecs(v2_15);
                } catch (String v1_22) {
                    StringBuilder v3_10 = new StringBuilder();
                    v3_10.append("Error while setting TLS 1.2");
                    v3_10.append(v1_22);
                    com.upi.hcesdk.util.LogUtil.error(com.upi.hcesdk.mpp.MppHostAdaptor.LOGTAG, v3_10.toString());
                }
            }
            v5_6.hostnameVerifier(new com.upi.hcesdk.mpp.MppHostAdaptor$7(this));
            v0_0 = v5_6.build();
        }
    }

Method com.upi.hcesdk.mpp.MppHostAdaptor.getServiceSecuredTrustAll() calling method okhttp3.OkHttpClient$Builder.hostnameVerifier()


    private com.upi.hcesdk.mpp.MppHostService getServiceSecuredTrustAll()
    {
        okhttp3.OkHttpClient v0_0 = 0;
        try {
            String v1_12 = javax.net.ssl.SSLContext.getInstance("TLS");
            String v2_10 = javax.net.ssl.TrustManagerFactory.getInstance(javax.net.ssl.TrustManagerFactory.getDefaultAlgorithm());
            v2_10.init(this.getKeyStore());
            javax.net.ssl.KeyManagerFactory.getInstance(javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm()).init(this.keyStore, 0);
            okhttp3.OkHttpClient$Builder v4_1 = new javax.net.ssl.TrustManager[1];
            v4_1[0] = new com.upi.hcesdk.mpp.MppHostAdaptor$5(this);
            v1_12.init(0, v4_1, 0);
            String v2_4 = v2_10.getTrustManagers();
        } catch (Exception) {
            if (this.service == null) {
                if (this.restAdapter == null) {
                    this.restAdapter = new retrofit.RestAdapter$Builder().setEndpoint(this.getHostURL()).setLogLevel(retrofit.RestAdapter$LogLevel.BASIC).setClient(new com.a.a.a(v0_0)).build();
                    this.service = ((com.upi.hcesdk.mpp.MppHostService) this.restAdapter.create(com.upi.hcesdk.mpp.MppHostService));
                }
            }
            return this.service;
        }
        if ((v2_4.length != 1) || (!(v2_4[0] instanceof javax.net.ssl.X509TrustManager))) {
            StringBuilder v3_4 = new StringBuilder();
            v3_4.append("Unexpected default trust managers:");
            v3_4.append(java.util.Arrays.toString(v2_4));
            throw new IllegalStateException(v3_4.toString());
        } else {
            String v2_8 = ((javax.net.ssl.X509TrustManager) v2_4[0]);
            okhttp3.OkHttpClient$Builder v4_10 = new okhttp3.OkHttpClient$Builder().connectTimeout(60, java.util.concurrent.TimeUnit.SECONDS).writeTimeout(60, java.util.concurrent.TimeUnit.SECONDS).readTimeout(60, java.util.concurrent.TimeUnit.SECONDS);
            if ((android.os.Build$VERSION.SDK_INT < 16) || (android.os.Build$VERSION.SDK_INT >= 22)) {
                v4_10.sslSocketFactory(v1_12.getSocketFactory(), v2_8);
            } else {
                try {
                    v4_10.sslSocketFactory(new com.upi.hcesdk.mpp.Tls12SocketFactory(v1_12.getSocketFactory()), v2_8);
                    String v1_18 = new okhttp3.ConnectionSpec$Builder(okhttp3.ConnectionSpec.MODERN_TLS);
                    String v2_13 = new okhttp3.TlsVersion[2];
                    v2_13[0] = okhttp3.TlsVersion.TLS_1_2;
                    v2_13[1] = okhttp3.TlsVersion.TLS_1_1;
                    String v1_20 = v1_18.tlsVersions(v2_13).build();
                    String v2_15 = new java.util.ArrayList();
                    v2_15.add(v1_20);
                    v2_15.add(okhttp3.ConnectionSpec.COMPATIBLE_TLS);
                    v2_15.add(okhttp3.ConnectionSpec.CLEARTEXT);
                    v4_10.connectionSpecs(v2_15);
                } catch (String v1_23) {
                    StringBuilder v3_7 = new StringBuilder();
                    v3_7.append("Error while setting TLS 1.2");
                    v3_7.append(v1_23);
                    com.upi.hcesdk.util.LogUtil.error(com.upi.hcesdk.mpp.MppHostAdaptor.LOGTAG, v3_7.toString());
                }
            }
            v4_10.hostnameVerifier(new com.upi.hcesdk.mpp.MppHostAdaptor$6(this));
            v0_0 = v4_10.build();
        }
    }