当前位置: 首页>>代码示例>>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;未经允许,请勿转载。