本文整理汇总了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);
}
}
示例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);
}
});
}
});
}
}
示例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);
}
});
}
});
}
}
示例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);
}
}