當前位置: 首頁>>代碼示例>>Java>>正文


Java UnrecognizedCertificateException類代碼示例

本文整理匯總了Java中org.matrix.androidsdk.ssl.UnrecognizedCertificateException的典型用法代碼示例。如果您正苦於以下問題:Java UnrecognizedCertificateException類的具體用法?Java UnrecognizedCertificateException怎麽用?Java UnrecognizedCertificateException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UnrecognizedCertificateException類屬於org.matrix.androidsdk.ssl包,在下文中一共展示了UnrecognizedCertificateException類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: warnAfterCertificateError

import org.matrix.androidsdk.ssl.UnrecognizedCertificateException; //導入依賴的package包/類
/**
 * Display warning dialog in case of certificate error
 *
 * @param e        the exception
 * @param pid
 * @param listener
 */
private void warnAfterCertificateError(final Exception e, final ThreePid pid, final ThreePidRequestListener listener) {
    UnrecognizedCertificateException unrecCertEx = CertUtil.getCertificateException(e);
    if (unrecCertEx != null) {
        final Fingerprint fingerprint = unrecCertEx.getFingerprint();

        UnrecognizedCertHandler.show(mHsConfig, fingerprint, false, new UnrecognizedCertHandler.Callback() {
            @Override
            public void onAccept() {
                requestValidationToken(pid, listener);
            }

            @Override
            public void onIgnore() {
                listener.onThreePidRequested(pid);
            }

            @Override
            public void onReject() {
                listener.onThreePidRequested(pid);
            }
        });
    } else {
        listener.onThreePidRequested(pid);
    }
}
 
開發者ID:vector-im,項目名稱:riot-android,代碼行數:33,代碼來源:RegistrationManager.java

示例2: onNetworkError

import org.matrix.androidsdk.ssl.UnrecognizedCertificateException; //導入依賴的package包/類
@Override
public void onNetworkError(final Exception e) {
    Log.e(LOG_TAG, "Network error: " + e.getMessage());

    // do not trigger toaster if the application is in background
    if (!ConsoleApplication.isAppInBackground()) {
        UnrecognizedCertificateException unrecCertEx = CertUtil.getCertificateException(e);
        if (unrecCertEx == null) {
            handleNetworkError(e);
            return;
        }

        final Fingerprint fingerprint = unrecCertEx.getFingerprint();
        Log.d(LOG_TAG, "Found fingerprint: SHA-256: " + fingerprint.getBytesAsHexString());

        mActivity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                UnrecognizedCertHandler.show(mSession.getHomeserverConfig(), fingerprint, true, new UnrecognizedCertHandler.Callback() {
                    @Override
                    public void onAccept() {
                        LoginStorage loginStorage = Matrix.getInstance(mActivity.getApplicationContext()).getLoginStorage();
                        loginStorage.replaceCredentials(mSession.getHomeserverConfig());
                    }

                    @Override
                    public void onIgnore() {
                        handleNetworkError(e);
                    }

                    @Override
                    public void onReject() {
                        CommonActivityUtils.logout(mActivity, mSession, true);
                    }
                });
            }
        });

    }
}
 
開發者ID:matrix-org,項目名稱:matrix-android-console,代碼行數:41,代碼來源:ErrorListener.java

示例3: onNetworkError

import org.matrix.androidsdk.ssl.UnrecognizedCertificateException; //導入依賴的package包/類
@Override
public void onNetworkError(final Exception e) {
    Log.e(LOG_TAG, "Network error: " + e.getMessage());

    // do not trigger toaster if the application is in background
    if (!VectorApp.isAppInBackground()) {
        UnrecognizedCertificateException unrecCertEx = CertUtil.getCertificateException(e);
        if (unrecCertEx == null) {
            handleNetworkError(e);
            return;
        }

        final Fingerprint fingerprint = unrecCertEx.getFingerprint();
        Log.d(LOG_TAG, "Found fingerprint: SHA-256: " + fingerprint.getBytesAsHexString());

        mActivity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                UnrecognizedCertHandler.show(mSession.getHomeServerConfig(), fingerprint, true, new UnrecognizedCertHandler.Callback() {
                    @Override
                    public void onAccept() {
                        LoginStorage loginStorage = Matrix.getInstance(mActivity.getApplicationContext()).getLoginStorage();
                        loginStorage.replaceCredentials(mSession.getHomeServerConfig());
                    }

                    @Override
                    public void onIgnore() {
                        handleNetworkError(e);
                    }

                    @Override
                    public void onReject() {
                        Log.d(LOG_TAG, "Found fingerprint: reject fingerprint");
                        CommonActivityUtils.logout(mActivity, Arrays.asList(mSession), true, null);
                    }
                });
            }
        });
    }
}
 
開發者ID:vector-im,項目名稱:riot-android,代碼行數:41,代碼來源:ErrorListener.java

示例4: onSSLCertificateError

import org.matrix.androidsdk.ssl.UnrecognizedCertificateException; //導入依賴的package包/類
/**
 * Call when the requests are rejected after a SSL update.
 *
 * @param exception the SSL certificate exception
 */
public void onSSLCertificateError(UnrecognizedCertificateException exception) {
    if (null != mRequestNetworkErrorListener) {
        mRequestNetworkErrorListener.onSSLCertificateError(exception);
    }
}
 
開發者ID:matrix-org,項目名稱:matrix-android-sdk,代碼行數:11,代碼來源:MXDataHandler.java


注:本文中的org.matrix.androidsdk.ssl.UnrecognizedCertificateException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。