1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-21 23:32:51 +00:00

Added key size to certificate list

This commit is contained in:
M66B 2024-12-21 13:54:42 +01:00
parent c6ad264b66
commit 09bb9e1054

View file

@ -49,11 +49,13 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.CertificateParsingException;
import java.security.cert.X509Certificate;
import java.security.interfaces.RSAPublicKey;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -119,11 +121,17 @@ public class EntityCertificate {
}
String getSigAlgName() {
StringBuilder sb = new StringBuilder();
try {
return getCertificate().getSigAlgName();
X509Certificate cert = getCertificate();
sb.append(cert.getSigAlgName());
PublicKey pubkey = cert.getPublicKey();
if (pubkey instanceof RSAPublicKey)
sb.append(((RSAPublicKey) pubkey).getModulus().bitLength());
} catch (Throwable ex) {
return null;
Log.w(ex);
}
return (sb.length() == 0 ? null : sb.toString());
}
List<String> getKeyUsage() {