SSL debug info

pull/194/merge
M66B 3 years ago
parent cd89ea1bed
commit 3b1ff558db

@ -148,6 +148,7 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import io.requery.android.database.CursorWindowAllocationException;
@ -2698,16 +2699,28 @@ public class Log {
static SpannableStringBuilder getCiphers() {
SpannableStringBuilder ssb = new SpannableStringBuilderEx();
for (String protocol : new String[]{"SSL", "TLS"}) {
try {
int begin = ssb.length();
ssb.append(protocol).append("\n\n");
ssb.setSpan(new StyleSpan(Typeface.BOLD), begin, ssb.length(), 0);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null);
SSLContext sslContext = SSLContext.getInstance(protocol);
ssb.append("Provider: ").append(tmf.getProvider().getName()).append("\r\n");
ssb.append("Algorithm: ").append(tmf.getAlgorithm()).append("\r\n");
TrustManager[] tms = tmf.getTrustManagers();
if (tms != null)
for (TrustManager tm : tms)
ssb.append("Manager: ").append(tm.getClass().getName()).append("\r\n");
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance("SSL");
} catch (Throwable ex) {
Log.e(ex);
sslContext = SSLContext.getInstance("TLS");
}
ssb.append("Context: ").append(sslContext.getProtocol()).append("\r\n\r\n");
sslContext.init(null, tmf.getTrustManagers(), null);
SSLSocket socket = (SSLSocket) sslContext.getSocketFactory().createSocket();
@ -2743,7 +2756,6 @@ public class Log {
} catch (Throwable ex) {
ssb.append(ex.toString());
}
}
ssb.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_SMALL), 0, ssb.length(), 0);

Loading…
Cancel
Save