Java Code Examples for android.net.http.SslCertificate#DName
The following examples show how to use
android.net.http.SslCertificate#DName .
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: SslCertificateViewAdapter.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
private void showSubject(SslCertificate.DName subject, View dialogView) { TextView cnView = ((TextView)dialogView.findViewById(R.id.value_subject_CN)); cnView.setText(subject.getCName()); cnView.setVisibility(View.VISIBLE); TextView oView = ((TextView)dialogView.findViewById(R.id.value_subject_O)); oView.setText(subject.getOName()); oView.setVisibility(View.VISIBLE); TextView ouView = ((TextView)dialogView.findViewById(R.id.value_subject_OU)); ouView.setText(subject.getUName()); ouView.setVisibility(View.VISIBLE); // SslCertificates don't offer this information dialogView.findViewById(R.id.value_subject_C).setVisibility(View.GONE); dialogView.findViewById(R.id.value_subject_ST).setVisibility(View.GONE); dialogView.findViewById(R.id.value_subject_L).setVisibility(View.GONE); dialogView.findViewById(R.id.label_subject_C).setVisibility(View.GONE); dialogView.findViewById(R.id.label_subject_ST).setVisibility(View.GONE); dialogView.findViewById(R.id.label_subject_L).setVisibility(View.GONE); }
Example 2
Source File: SslCertificateViewAdapter.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
private void showIssuer(SslCertificate.DName issuer, View dialogView) { TextView cnView = ((TextView)dialogView.findViewById(R.id.value_issuer_CN)); cnView.setText(issuer.getCName()); cnView.setVisibility(View.VISIBLE); TextView oView = ((TextView)dialogView.findViewById(R.id.value_issuer_O)); oView.setText(issuer.getOName()); oView.setVisibility(View.VISIBLE); TextView ouView = ((TextView)dialogView.findViewById(R.id.value_issuer_OU)); ouView.setText(issuer.getUName()); ouView.setVisibility(View.VISIBLE); // SslCertificates don't offer this information dialogView.findViewById(R.id.value_issuer_C).setVisibility(View.GONE); dialogView.findViewById(R.id.value_issuer_ST).setVisibility(View.GONE); dialogView.findViewById(R.id.value_issuer_L).setVisibility(View.GONE); dialogView.findViewById(R.id.label_issuer_C).setVisibility(View.GONE); dialogView.findViewById(R.id.label_issuer_ST).setVisibility(View.GONE); dialogView.findViewById(R.id.label_issuer_L).setVisibility(View.GONE); }
Example 3
Source File: WebViewActivity.java From DeviceConnect-Android with MIT License | 6 votes |
@Override public void onReceivedSslError(final WebView view, final SslErrorHandler handler, final SslError error) { int primaryError = error.getPrimaryError(); String url = error.getUrl(); SslCertificate cert = error.getCertificate(); mLogger.warning("onReceivedSslError: error = " + primaryError + ", url = " + url + ", certificate = " + cert); if (primaryError == SslError.SSL_UNTRUSTED && url != null && cert != null) { SslCertificate.DName subjectName = cert.getIssuedTo(); if (subjectName != null && "localhost".equals(subjectName.getCName()) && url.startsWith("https://localhost") ) { handler.proceed(); mLogger.warning("SSL Proceeded: url = " + url); return; } } handler.cancel(); mLogger.severe("SSL Canceled: url = " + url); }
Example 4
Source File: OAuthWebView.java From box-android-sdk with Apache License 2.0 | 4 votes |
private View getCertErrorView(final Context context, final SslCertificate certificate){ LayoutInflater factory = LayoutInflater.from(context); View certificateView = factory.inflate( R.layout.ssl_certificate, null); // issued to: SslCertificate.DName issuedTo = certificate.getIssuedTo(); if (issuedTo != null) { ((TextView) certificateView.findViewById(R.id.to_common)) .setText(issuedTo.getCName()); ((TextView) certificateView.findViewById(R.id.to_org)) .setText(issuedTo.getOName()); ((TextView) certificateView.findViewById(R.id.to_org_unit)) .setText(issuedTo.getUName()); } // issued by: SslCertificate.DName issuedBy = certificate.getIssuedBy(); if (issuedBy != null) { ((TextView) certificateView.findViewById(R.id.by_common)) .setText(issuedBy.getCName()); ((TextView) certificateView.findViewById(R.id.by_org)) .setText(issuedBy.getOName()); ((TextView) certificateView.findViewById(R.id.by_org_unit)) .setText(issuedBy.getUName()); } // issued on: String issuedOn = formatCertificateDate(context, certificate.getValidNotBeforeDate()); ((TextView) certificateView.findViewById(R.id.issued_on)) .setText(issuedOn); // expires on: String expiresOn = formatCertificateDate(context, certificate.getValidNotAfterDate()); ((TextView) certificateView.findViewById(R.id.expires_on)) .setText(expiresOn); return certificateView; }