fix: log encoded certificate

the certificate chain fails to log very often
This commit is contained in:
Benjamin Wiegand
2026-06-23 12:45:17 -07:00
parent 5db0576f5d
commit 97631d0529
@@ -1,8 +1,10 @@
package io.benwiegand.projection.geargrinder.crypto;
import android.annotation.SuppressLint;
import android.util.Base64;
import android.util.Log;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
@@ -18,6 +20,14 @@ public class LGTMTrustManager implements X509TrustManager {
} catch (Throwable t) {
Log.e(TAG, "explosions while logging cert chain", t);
}
for (X509Certificate certificate : chain) {
try {
Log.i(TAG, "cert: " + Base64.encodeToString(certificate.getEncoded(), 0));
} catch (CertificateEncodingException e) {
Log.e(TAG, "failed to log encoded certificate", e);
}
}
}
@Override