Added listing of protocols and ciphers

pull/178/head
M66B 5 years ago
parent d4c87a9762
commit 40ee6cba34

@ -50,9 +50,16 @@ import androidx.lifecycle.Observer;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.SortedMap;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import io.requery.android.database.sqlite.SQLiteDatabase;
public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -81,6 +88,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvStorageSpace;
private TextView tvFingerprint;
private Button btnCharsets;
private Button btnCiphers;
private Group grpDebug;
@ -134,6 +142,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvStorageSpace = view.findViewById(R.id.tvStorageSpace);
tvFingerprint = view.findViewById(R.id.tvFingerprint);
btnCharsets = view.findViewById(R.id.btnCharsets);
btnCiphers = view.findViewById(R.id.btnCiphers);
grpDebug = view.findViewById(R.id.grpDebug);
@ -331,6 +340,57 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
btnCiphers.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StringBuilder sb = new StringBuilder();
try {
SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
List<String> protocols = new ArrayList<>();
protocols.addAll(Arrays.asList(socket.getEnabledProtocols()));
List<String> ciphers = new ArrayList<>();
ciphers.addAll(Arrays.asList(socket.getEnabledCipherSuites()));
for (String p : socket.getSupportedProtocols()) {
boolean enabled = protocols.contains(p);
if (!enabled)
sb.append("(");
sb.append(p);
if (!enabled)
sb.append(")");
sb.append("\r\n");
}
sb.append("\r\n");
for (String c : socket.getSupportedCipherSuites()) {
boolean enabled = ciphers.contains(c);
if (!enabled)
sb.append("(");
sb.append(c);
if (!enabled)
sb.append(")");
sb.append("\r\n");
}
sb.append("\r\n");
} catch (IOException ex) {
sb.append(ex.toString());
}
new AlertDialog.Builder(getContext())
.setTitle(R.string.title_advanced_ciphers)
.setMessage(sb.toString())
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do nothing
}
})
.show();
}
});
tvFtsIndexed.setText(null);
DB db = DB.getInstance(getContext());

@ -382,10 +382,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFingerprint" />
<Button
android:id="@+id/btnCiphers"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_ciphers"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnCharsets" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpDebug"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvProcessors,tvMemoryClass,tvStorageSpace,tvFingerprint,btnCharsets" />
app:constraint_referenced_ids="tvProcessors,tvMemoryClass,tvStorageSpace,tvFingerprint,btnCharsets,btnCiphers" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

@ -458,6 +458,7 @@
<string name="title_advanced_memory_class" translatable="false">Memory class: %1$s</string>
<string name="title_advanced_storage_space" translatable="false">Storage space: %1$s/%2$s</string>
<string name="title_advanced_charsets" translatable="false">Charsets</string>
<string name="title_advanced_ciphers" translatable="false">Ciphers</string>
<string name="title_advanced_enabled_hint">Globally disable or enable receiving of messages</string>
<string name="title_advanced_manual_hint">If synchronization is disabled, it is still possible to synchronize manually by pulling down the message list.</string>

Loading…
Cancel
Save