mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-22 07:42:52 +00:00
Show info encryption algo
This commit is contained in:
parent
09bb9e1054
commit
b5b1cba507
2 changed files with 23 additions and 16 deletions
|
@ -198,6 +198,7 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
|
import java.security.PublicKey;
|
||||||
import java.security.cert.CertPathBuilder;
|
import java.security.cert.CertPathBuilder;
|
||||||
import java.security.cert.CertPathBuilderResult;
|
import java.security.cert.CertPathBuilderResult;
|
||||||
import java.security.cert.CertPathValidator;
|
import java.security.cert.CertPathValidator;
|
||||||
|
@ -211,6 +212,7 @@ import java.security.cert.PKIXBuilderParameters;
|
||||||
import java.security.cert.PKIXCertPathValidatorResult;
|
import java.security.cert.PKIXCertPathValidatorResult;
|
||||||
import java.security.cert.X509CertSelector;
|
import java.security.cert.X509CertSelector;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
|
@ -10145,18 +10147,6 @@ public class FragmentMessages extends FragmentBase
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
known = true;
|
known = true;
|
||||||
|
|
||||||
String keyalgo = null;
|
|
||||||
String keyalgooid = null;
|
|
||||||
try {
|
|
||||||
keyalgooid = s.getEncryptionAlgOID();
|
|
||||||
DefaultAlgorithmNameFinder af = new DefaultAlgorithmNameFinder();
|
|
||||||
keyalgo = af.getAlgorithmName(new ASN1ObjectIdentifier(keyalgooid));
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
Log.e(ex);
|
|
||||||
}
|
|
||||||
args.putString("keyalgo", keyalgo);
|
|
||||||
args.putString("keyalgooid", keyalgooid);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10167,6 +10157,7 @@ public class FragmentMessages extends FragmentBase
|
||||||
args.putString("sender", sender);
|
args.putString("sender", sender);
|
||||||
args.putBoolean("known", known);
|
args.putBoolean("known", known);
|
||||||
|
|
||||||
|
// Sign algorithm
|
||||||
String algo = null;
|
String algo = null;
|
||||||
String algooid = null;
|
String algooid = null;
|
||||||
try {
|
try {
|
||||||
|
@ -10179,6 +10170,22 @@ public class FragmentMessages extends FragmentBase
|
||||||
args.putString("algo", algo);
|
args.putString("algo", algo);
|
||||||
args.putString("algooid", algooid);
|
args.putString("algooid", algooid);
|
||||||
|
|
||||||
|
// Encryption algorithm
|
||||||
|
String keyalgo = null;
|
||||||
|
String keyalgooid = null;
|
||||||
|
try {
|
||||||
|
keyalgooid = s.getEncryptionAlgOID();
|
||||||
|
DefaultAlgorithmNameFinder af = new DefaultAlgorithmNameFinder();
|
||||||
|
keyalgo = af.getAlgorithmName(new ASN1ObjectIdentifier(keyalgooid));
|
||||||
|
PublicKey pubkey = cert.getPublicKey();
|
||||||
|
if (pubkey instanceof RSAPublicKey)
|
||||||
|
keyalgo += ((RSAPublicKey) pubkey).getModulus().bitLength();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
}
|
||||||
|
args.putString("keyalgo", keyalgo);
|
||||||
|
args.putString("keyalgooid", keyalgooid);
|
||||||
|
|
||||||
List<X509Certificate> certs = new ArrayList<>();
|
List<X509Certificate> certs = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
for (Object m : store.getMatches(null)) {
|
for (Object m : store.getMatches(null)) {
|
||||||
|
@ -10487,10 +10494,10 @@ public class FragmentMessages extends FragmentBase
|
||||||
if (!TextUtils.isEmpty(keyalgo))
|
if (!TextUtils.isEmpty(keyalgo))
|
||||||
keyalgo = keyalgo.replaceAll("(?i)With", "/");
|
keyalgo = keyalgo.replaceAll("(?i)With", "/");
|
||||||
|
|
||||||
tvKeyAlgorithmTitle.setVisibility(info && known ? View.VISIBLE : View.GONE);
|
tvKeyAlgorithmTitle.setVisibility(info ? View.VISIBLE : View.GONE);
|
||||||
tvKeyAlgorithm.setVisibility(info && known ? View.VISIBLE : View.GONE);
|
tvKeyAlgorithm.setVisibility(info ? View.VISIBLE : View.GONE);
|
||||||
tvKeyAlgorithm.setText(keyalgo);
|
tvKeyAlgorithm.setText(keyalgo);
|
||||||
tvKeyAlgorithmOid.setVisibility(info && known ? View.VISIBLE : View.GONE);
|
tvKeyAlgorithmOid.setVisibility(info ? View.VISIBLE : View.GONE);
|
||||||
tvKeyAlgorithmOid.setText(keyalgooid);
|
tvKeyAlgorithmOid.setText(keyalgooid);
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:text="@string/title_signature_public_key"
|
android:text="@string/title_advanced_section_encryption"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvExpired" />
|
app:layout_constraintTop_toBottomOf="@id/tvExpired" />
|
||||||
|
|
Loading…
Reference in a new issue