List of usage examples for android.net.http SslCertificate getIssuedBy
public DName getIssuedBy()
From source file:com.mb.android.MainActivity.java
public void handleSslError(SslError error, final Response<Boolean> response) { final Context context = this; SslCertificate cert = error.getCertificate(); String issuedTo = cert.getIssuedTo().getDName(); String issuedBy = cert.getIssuedBy().getDName(); String issuedOn = cert.getValidNotBeforeDate().toString(); final String srch = error.getUrl() + "--" + issuedTo + "--" + issuedBy + "--" + issuedOn; final String results = getSharedPreferences(this).getString("acurls1", ""); if (StringHelper.IndexOfIgnoreCase(results, srch) != -1) { response.onResponse(true);//from w w w . ja v a 2s . co m return; } final AlertDialog.Builder builder = new AlertDialog.Builder(this); String message = getResources().getString(R.string.notification_error_ssl_cert_invalid) .replace("{0}", issuedTo.replace("localhost", "Emby Server")) .replace("{1}", issuedBy.replace("localhost", "Emby Server")).replace("{2}", issuedOn); builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences settings = getSharedPreferences(context); SharedPreferences.Editor editor = settings.edit(); editor.putString("acurls1", results + "|" + srch); // Commit the edits! boolean saved = editor.commit(); response.onResponse(true); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { response.onResponse(false); } }); final AlertDialog dialog = builder.create(); dialog.show(); }