android.net.http.SslError Java Examples
The following examples show how to use
android.net.http.SslError.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SystemWebViewClient.java From keemob with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #2
Source File: SslUntrustedCertDialog.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
public static SslUntrustedCertDialog newInstanceForFullSslError(X509Certificate cert, SslError error, SslErrorHandler handler) { if (cert == null) { throw new IllegalArgumentException("Trying to create instance with parameter cert == null"); } if (error == null) { throw new IllegalArgumentException("Trying to create instance with parameter error == null"); } if (handler == null) { throw new IllegalArgumentException("Trying to create instance with parameter handler == null"); } SslUntrustedCertDialog dialog = new SslUntrustedCertDialog(); dialog.m509Certificate = cert; dialog.mHandler = handler; dialog.mErrorViewAdapter = new SslErrorViewAdapter(error); dialog.mCertificateViewAdapter = new X509CertificateViewAdapter(cert); return dialog; }
Example #3
Source File: CordovaWebViewClient.java From phonegapbootcampsite with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = this.cordova.getActivity().getPackageName(); final PackageManager pm = this.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #4
Source File: SystemWebViewClient.java From xmall with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #5
Source File: SystemWebViewClient.java From a2cardboard with Apache License 2.0 | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #6
Source File: AuthenticatorActivity.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
/** * Show untrusted cert dialog */ public void showUntrustedCertDialog( X509Certificate x509Certificate, SslError error, SslErrorHandler handler ) { // Show a dialog with the certificate info SslUntrustedCertDialog dialog; if (x509Certificate == null) { dialog = SslUntrustedCertDialog.newInstanceForEmptySslError(error, handler); } else { dialog = SslUntrustedCertDialog. newInstanceForFullSslError(x509Certificate, error, handler); } FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.addToBackStack(null); dialog.show(ft, UNTRUSTED_CERT_DIALOG_TAG); }
Example #7
Source File: SystemWebViewClient.java From countly-sdk-cordova with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #8
Source File: Web3ViewClient.java From alpha-wallet-android with MIT License | 6 votes |
@Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { AWalletAlertDialog aDialog = new AWalletAlertDialog(context); aDialog.setTitle(R.string.title_dialog_error); aDialog.setIcon(AWalletAlertDialog.ERROR); aDialog.setMessage(R.string.ssl_cert_invalid); aDialog.setButtonText(R.string.dialog_approve); aDialog.setButtonListener(v -> { handler.proceed(); aDialog.dismiss(); }); aDialog.setSecondaryButtonText(R.string.action_cancel); aDialog.setButtonListener(v -> { handler.cancel(); aDialog.dismiss(); }); aDialog.show(); }
Example #9
Source File: SystemWebViewClient.java From app-icon with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #10
Source File: CordovaWebViewClient.java From bluemix-parking-meter with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = this.cordova.getActivity().getPackageName(); final PackageManager pm = this.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #11
Source File: LightningWebClient.java From Xndroid with GNU General Public License v3.0 | 6 votes |
@NonNull private static List<Integer> getAllSslErrorMessageCodes(@NonNull SslError error) { List<Integer> errorCodeMessageCodes = new ArrayList<>(1); if (error.hasError(SslError.SSL_DATE_INVALID)) { errorCodeMessageCodes.add(R.string.message_certificate_date_invalid); } if (error.hasError(SslError.SSL_EXPIRED)) { errorCodeMessageCodes.add(R.string.message_certificate_expired); } if (error.hasError(SslError.SSL_IDMISMATCH)) { errorCodeMessageCodes.add(R.string.message_certificate_domain_mismatch); } if (error.hasError(SslError.SSL_NOTYETVALID)) { errorCodeMessageCodes.add(R.string.message_certificate_not_yet_valid); } if (error.hasError(SslError.SSL_UNTRUSTED)) { errorCodeMessageCodes.add(R.string.message_certificate_untrusted); } if (error.hasError(SslError.SSL_INVALID)) { errorCodeMessageCodes.add(R.string.message_certificate_invalid); } return errorCodeMessageCodes; }
Example #12
Source File: SystemWebViewClient.java From ultimate-cordova-webview-app with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #13
Source File: XWalkCordovaResourceClient.java From cordova-crosswalk-engine with Apache License 2.0 | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a * resource. The host application must call either callback.onReceiveValue(true) * or callback.onReceiveValue(false). Note that the decision may be * retained for use in response to future SSL errors. The default behavior * is to pop up a dialog. */ @Override public void onReceivedSslError(XWalkView view, ValueCallback<Boolean> callback, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true callback.onReceiveValue(true); } else { // debug = false callback.onReceiveValue(false); } } catch (PackageManager.NameNotFoundException e) { // When it doubt, lock it out! callback.onReceiveValue(false); } }
Example #14
Source File: CordovaWebViewClient.java From cordova-amazon-fireos with Apache License 2.0 | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The AmazonWebView that is initiating the callback. * @param handler An AmazonSslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(AmazonWebView view, AmazonSslErrorHandler handler, SslError error) { final String packageName = this.cordova.getActivity().getPackageName(); final PackageManager pm = this.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #15
Source File: WebViewActivity.java From Bailan with Apache License 2.0 | 6 votes |
@Override protected void initView() { String name = getIntent().getStringExtra("name"); String url = getIntent().getStringExtra("url"); //设置沉浸式状态栏 setStatus(); iv_search.setVisibility(View.VISIBLE); //设置沉浸式状态栏背景 bar_layout.setBackgroundResource(R.color.black_alpha_5); title_text.setText(name); wv.setWebViewClient(new WebViewClient() { @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { super.onReceivedSslError(view, handler, error); handler.proceed(); } }); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl(url); }
Example #16
Source File: SystemWebViewClient.java From cordova-plugin-intent with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #17
Source File: CordovaWebViewClient.java From wildfly-samples with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = this.cordova.getActivity().getPackageName(); final PackageManager pm = this.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #18
Source File: SystemWebViewClient.java From cordova-plugin-app-update-demo with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #19
Source File: CordovaWebViewClient.java From IoTgo_Android_App with MIT License | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = this.cordova.getActivity().getPackageName(); final PackageManager pm = this.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #20
Source File: CordovaWebViewClient.java From crosswalk-cordova-android with Apache License 2.0 | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a * resource. The host application must call either callback.onReceiveValue(true) * or callback.onReceiveValue(false). Note that the decision may be * retained for use in response to future SSL errors. The default behavior * is to pop up a dialog. */ public void onReceivedSslError(XWalkView view, ValueCallback<Boolean> callback, SslError error) { final String packageName = this.cordova.getActivity().getPackageName(); final PackageManager pm = this.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true callback.onReceiveValue(true); return; } else { // debug = false callback.onReceiveValue(false); } } catch (NameNotFoundException e) { // When it doubt, lock it out! callback.onReceiveValue(false); } }
Example #21
Source File: SystemWebViewClient.java From chappiecast with Mozilla Public License 2.0 | 6 votes |
/** * Notify the host application that an SSL error occurred while loading a resource. * The host application must call either handler.cancel() or handler.proceed(). * Note that the decision may be retained for use in response to future SSL errors. * The default behavior is to cancel the load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's response. * @param error The SSL error object. */ @TargetApi(8) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { final String packageName = parentEngine.cordova.getActivity().getPackageName(); final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager(); ApplicationInfo appInfo; try { appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // debug = true handler.proceed(); return; } else { // debug = false super.onReceivedSslError(view, handler, error); } } catch (NameNotFoundException e) { // When it doubt, lock it out! super.onReceivedSslError(view, handler, error); } }
Example #22
Source File: CertificatesCordovaWebViewClient.java From cordova-certificate-plugin with MIT License | 5 votes |
/** * @see org.apache.cordova.SystemWebViewClient#onReceivedSslError(WebView, * SslErrorHandler, SslError) */ @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { Log.d(TAG, "onReceivedSslError. Proceed? " + isAllowUntrusted()); if (isAllowUntrusted()) { handler.proceed(); } else { super.onReceivedSslError(view, handler, error); } }
Example #23
Source File: BridgeWebViewClient.java From JsBridge with MIT License | 5 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { boolean interrupt = false; if (bridgeWebViewClientListener != null) { interrupt = bridgeWebViewClientListener.onReceivedSslError(view, handler, error); } if (!interrupt) { super.onReceivedSslError(view, handler, error); } }
Example #24
Source File: InAppBrowser.java From cordova-plugin-inappbrowser with Apache License 2.0 | 5 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { super.onReceivedSslError(view, handler, error); try { JSONObject obj = new JSONObject(); obj.put("type", LOAD_ERROR_EVENT); obj.put("url", error.getUrl()); obj.put("code", 0); obj.put("sslerror", error.getPrimaryError()); String message; switch (error.getPrimaryError()) { case SslError.SSL_DATE_INVALID: message = "The date of the certificate is invalid"; break; case SslError.SSL_EXPIRED: message = "The certificate has expired"; break; case SslError.SSL_IDMISMATCH: message = "Hostname mismatch"; break; default: case SslError.SSL_INVALID: message = "A generic error occurred"; break; case SslError.SSL_NOTYETVALID: message = "The certificate is not yet valid"; break; case SslError.SSL_UNTRUSTED: message = "The certificate authority is not trusted"; break; } obj.put("message", message); sendUpdate(obj, true, PluginResult.Status.ERROR); } catch (JSONException ex) { LOG.d(LOG_TAG, "Should never happen"); } handler.cancel(); }
Example #25
Source File: WebViewActivity.java From checkey with GNU General Public License v3.0 | 5 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { String host = uri.getHost(); int errno = error.getPrimaryError(); if (host.equals("androidobservatory.org") && (errno == SslError.SSL_EXPIRED || errno == SslError.SSL_UNTRUSTED)) { handler.proceed(); } else { super.onReceivedSslError(view, handler, error); } }
Example #26
Source File: WebViewActivity.java From movienow with GNU General Public License v3.0 | 5 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { Snackbar.make(webViewT, "证书校验失败,是否回撤网页?", Snackbar.LENGTH_LONG) .setAction("回撤", new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }).show(); handler.proceed(); }
Example #27
Source File: WebGuiActivity.java From syncthing-android with Mozilla Public License 2.0 | 5 votes |
/** * Catch (self-signed) SSL errors and test if they correspond to Syncthing's certificate. */ @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { try { int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // The mX509Certificate field is not available for ICS- devices Log.w(TAG, "Skipping certificate check for devices <ICS"); handler.proceed(); return; } // Use reflection to access the private mX509Certificate field of SslCertificate SslCertificate sslCert = error.getCertificate(); Field f = sslCert.getClass().getDeclaredField("mX509Certificate"); f.setAccessible(true); X509Certificate cert = (X509Certificate)f.get(sslCert); if (cert == null) { Log.w(TAG, "X509Certificate reference invalid"); handler.cancel(); return; } cert.verify(mCaCert.getPublicKey()); handler.proceed(); } catch (NoSuchFieldException|IllegalAccessException|CertificateException| NoSuchAlgorithmException|InvalidKeyException|NoSuchProviderException| SignatureException e) { Log.w(TAG, e); handler.cancel(); } }
Example #28
Source File: SslUntrustedCertDialog.java From Cirrus_depricated with GNU General Public License v2.0 | 5 votes |
public static SslUntrustedCertDialog newInstanceForEmptySslError(SslError error, SslErrorHandler handler) { if (error == null) { throw new IllegalArgumentException("Trying to create instance with parameter error == null"); } if (handler == null) { throw new IllegalArgumentException("Trying to create instance with parameter handler == null"); } SslUntrustedCertDialog dialog = new SslUntrustedCertDialog(); dialog.mHandler = handler; dialog.mErrorViewAdapter = new SslErrorViewAdapter(error); dialog.mCertificateViewAdapter = new SslCertificateViewAdapter(error.getCertificate()); return dialog; }
Example #29
Source File: MainActivity.java From Android-SmartWebView with MIT License | 5 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if(ASWP_CERT_VERIFICATION) { super.onReceivedSslError(view, handler, error); } else { handler.proceed(); // Ignore SSL certificate errors } }
Example #30
Source File: WebDialog.java From Klyph with MIT License | 5 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if (DISABLE_SSL_CHECK_FOR_TESTING) { handler.proceed(); } else { super.onReceivedSslError(view, handler, error); sendErrorToListener(new FacebookDialogException(null, ERROR_FAILED_SSL_HANDSHAKE, null)); handler.cancel(); WebDialog.this.dismiss(); } }