mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-22 07:42:52 +00:00
Added key size to certificate list
This commit is contained in:
parent
c6ad264b66
commit
09bb9e1054
1 changed files with 10 additions and 2 deletions
|
@ -49,11 +49,13 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.PublicKey;
|
||||||
import java.security.cert.CertificateEncodingException;
|
import java.security.cert.CertificateEncodingException;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.security.cert.CertificateFactory;
|
import java.security.cert.CertificateFactory;
|
||||||
import java.security.cert.CertificateParsingException;
|
import java.security.cert.CertificateParsingException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -119,11 +121,17 @@ public class EntityCertificate {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getSigAlgName() {
|
String getSigAlgName() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
try {
|
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) {
|
} catch (Throwable ex) {
|
||||||
return null;
|
Log.w(ex);
|
||||||
}
|
}
|
||||||
|
return (sb.length() == 0 ? null : sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> getKeyUsage() {
|
List<String> getKeyUsage() {
|
||||||
|
|
Loading…
Reference in a new issue