Android SslError - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SslError class.

This code example shows how to use the following methods:getCertificate, getPrimaryError
            Logger.D(TAG, "Skip SSL error.");
            handler.proceed();
        } else { 
            StringBuilder msg = new StringBuilder();
            msg.append("SSL error - ");
            switch(error.getPrimaryError()) {
            case SslError.SSL_NOTYETVALID:
                msg.append("The certificate is not yet valid: ");
                break; 
            case SslError.SSL_EXPIRED:
                msg.append("The certificate has expired: ");
                break; 
            case SslError.SSL_IDMISMATCH:
                msg.append("Hostname mismatch: ");
                break; 
            case SslError.SSL_UNTRUSTED:
                msg.append("The certificate authority is not trusted: ");
                break; 
            } 
            msg.append(error.getCertificate().toString());

7
CodeRank
This code example shows how to use the following methods:hasError
	} 
	 
	public static int sslErrorToInt(SslError error) {
		int errorCode = 0;
		 
		if (error.hasError(SslError.SSL_UNTRUSTED)) {
			errorCode |= SSL_UNTRUSTED;
		} 
 
		if (error.hasError(SslError.SSL_IDMISMATCH)) {
			errorCode |= SSL_IDMISMATCH;
		} 
 
		if (error.hasError(SslError.SSL_EXPIRED)) {
			errorCode |= SSL_EXPIRED;
		} 
 
		if (error.hasError(SslError.SSL_NOTYETVALID)) {
			errorCode |= SSL_NOTYETVALID;
		} 

7
CodeRank
This code example shows how to use the following methods:toString
        } 
 
        @Override 
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
            //ignore certificate error 
            Log.v(LOGTAG, "Received SSL error: " + error.toString());
            handler.proceed();
        } 
 
        @Override 
        public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host,
                String realm) {
            // cancel http auth request 
            handler.cancel();
        } 
 
        @Override 
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            pageStartCount++;
            Log.v(LOGTAG, "onPageStarted: " + url);
5
CodeRank
This code example shows how to use the following methods:getCertificate, getPrimaryError
            Logger.D(TAG, "Skip SSL error.");
            handler.proceed();
        } else { 
            StringBuilder msg = new StringBuilder();
            msg.append("SSL error - ");
            switch(error.getPrimaryError()) {
            case SslError.SSL_NOTYETVALID:
                msg.append("The certificate is not yet valid: ");
                break; 
            case SslError.SSL_EXPIRED:
                msg.append("The certificate has expired: ");
                break; 
            case SslError.SSL_IDMISMATCH:
                msg.append("Hostname mismatch: ");
                break; 
            case SslError.SSL_UNTRUSTED:
                msg.append("The certificate authority is not trusted: ");
                break; 
            } 
            msg.append(error.getCertificate().toString());

4
CodeRank
This code example shows how to use the following methods:toString
  } 
 
  @Override 
  public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    boolean shouldAcceptSslCerts = driver.getAcceptSslCerts();
    Logger.log(Log.DEBUG, LOG_TAG, "onReceivedSslError: " + error.toString()
        + ", shouldAcceptSslCerts: " + shouldAcceptSslCerts);
 
    if (shouldAcceptSslCerts) {
      handler.proceed();
    } else { 
      super.onReceivedSslError(view, handler, error);
    } 
  } 
 
  private String tmpUrl;
 
  @Override 
  public void onPageStarted(WebView view, String url, Bitmap favicon) {
    driver.setLastUrlLoaded(url);
4
CodeRank
This code example shows how to use the following methods:toString
                                                         + ", error code: " + errorCode);
  } 
 
  public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    boolean shouldAcceptSslCerts = driver.getAcceptSslCerts();
    Logger.log(Level.WARNING, LOG_TAG, "onReceivedSslError", error.toString()
        + ", shouldAcceptSslCerts: " + shouldAcceptSslCerts);
 
    if (shouldAcceptSslCerts) {
      handler.proceed();
    } 
  } 
 
  public void onPageStarted(WebView view, String url) {
    // To avoid blocking on background windows 
    if (driver.getWebView().equals(view)) {
      driver.setLastUrlLoaded(url);
      tmpUrl = url;
      driver.notifyPageStartedLoading();
    } 
4
CodeRank
This code example shows how to use the following methods:toString
    } 
 
    @SuppressLint("NewApi") 
	public void onReceivedSslError(WebView view, SslErrorHandler handler,
            SslError error) {
        MyLog.e(TAG, " received ss: error:" + error.toString());
        handler.proceed();
    } 
 
    @Override 
    public void onReceivedHttpAuthRequest(WebView webView,
            HttpAuthHandler handler, String host, String realm) {
    	MyLog.d(TAG, "onReceivedHttpAuthRequest: host => " + host + ", realm => "
                + realm);
        String[] up = webView.getHttpAuthUsernamePassword(host, realm);
 
        if (up != null && up.length == 2 && up[0] != null && up[1] != null) {
            handler.proceed(up[0], up[1]);
        } else { 
            super.onReceivedHttpAuthRequest(webView, handler, host, realm);
4
CodeRank
This code example shows how to use the following methods:toString
         */ 
        @Override 
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { 
            Log.d(TAG, "[onReceivedSslError]"); 
 
            String message = error.toString(); 
            Log.e(TAG, message); 
            handler.proceed(); 
        } 
    }; 
 
    private void logAndToast(String message) {
        Log.d(TAG, message);
        Toast.makeText(this, message, Toast.LENGTH_LONG).show();
    } 
 
    /** 
     * This parses the Capture access token out of the sentinel URL 
     * @param url 
     *  The sentinel URL to parse the access token from. 
3
CodeRank
This code example shows how to use the following methods:toString
                                                         + ", error code: " + errorCode);
  } 
 
  public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    boolean shouldAcceptSslCerts = driver.getAcceptSslCerts();
    Logger.log(Level.WARNING, LOG_TAG, "onReceivedSslError", error.toString()
        + ", shouldAcceptSslCerts: " + shouldAcceptSslCerts);
 
    if (shouldAcceptSslCerts) {
      handler.proceed();
    } 
  } 
 
  public void onPageStarted(WebView view, String url) {
    // To avoid blocking on background windows 
    if (driver.getWebView().equals(view)) {
      driver.setLastUrlLoaded(url);
      tmpUrl = url;
      driver.notifyPageStartedLoading();
    } 
4
CodeRank

Related Android SslError Questions & Answers:

See Code Examples for Android SslError Methods: