本文整理匯總了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);
}
}