mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-21 23:32:51 +00:00
Show key oids
This commit is contained in:
parent
a02e9d7739
commit
7535c47bed
2 changed files with 68 additions and 15 deletions
|
@ -10137,15 +10137,26 @@ public class FragmentMessages extends FragmentBase
|
|||
if (s.verify(verifier)) {
|
||||
String fingerprint = EntityCertificate.getFingerprintSha256(cert);
|
||||
List<String> emails = EntityCertificate.getEmailAddresses(cert);
|
||||
boolean known = !emails.isEmpty();
|
||||
boolean known = false;
|
||||
for (String email : emails) {
|
||||
EntityCertificate record = db.certificate().getCertificate(fingerprint, email);
|
||||
if (record == null)
|
||||
known = false;
|
||||
else {
|
||||
args.putString("keyalgo", record.getSigAlgName());
|
||||
break;
|
||||
continue;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
String sender = null;
|
||||
|
@ -10155,15 +10166,17 @@ public class FragmentMessages extends FragmentBase
|
|||
args.putString("sender", sender);
|
||||
args.putBoolean("known", known);
|
||||
|
||||
String algo;
|
||||
String algo = null;
|
||||
String algooid = null;
|
||||
try {
|
||||
algooid = s.getEncryptionAlgOID();
|
||||
DefaultAlgorithmNameFinder af = new DefaultAlgorithmNameFinder();
|
||||
algo = af.getAlgorithmName(new ASN1ObjectIdentifier(s.getEncryptionAlgOID()));
|
||||
algo = af.getAlgorithmName(new ASN1ObjectIdentifier(algooid));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
algo = s.getEncryptionAlgOID();
|
||||
}
|
||||
args.putString("algo", algo);
|
||||
args.putString("algooid", algooid);
|
||||
|
||||
List<X509Certificate> certs = new ArrayList<>();
|
||||
try {
|
||||
|
@ -10411,7 +10424,9 @@ public class FragmentMessages extends FragmentBase
|
|||
boolean valid = args.getBoolean("valid");
|
||||
String reason = args.getString("reason");
|
||||
String algo = args.getString("algo");
|
||||
String algooid = args.getString("algooid");
|
||||
String keyalgo = args.getString("keyalgo");
|
||||
String keyalgooid = args.getString("keyalgooid");
|
||||
final ArrayList<String> trace = args.getStringArrayList("trace");
|
||||
EntityCertificate record = EntityCertificate.from(cert, null);
|
||||
|
||||
|
@ -10443,8 +10458,10 @@ public class FragmentMessages extends FragmentBase
|
|||
TextView tvBefore = dview.findViewById(R.id.tvBefore);
|
||||
TextView tvExpired = dview.findViewById(R.id.tvExpired);
|
||||
TextView tvAlgorithm = dview.findViewById(R.id.tvAlgorithm);
|
||||
TextView tvAlgorithmOid = dview.findViewById(R.id.tvAlgorithmOid);
|
||||
TextView tvKeyAlgorithmTitle = dview.findViewById(R.id.tvKeyAlgorithmTitle);
|
||||
TextView tvKeyAlgorithm = dview.findViewById(R.id.tvKeyAlgorithm);
|
||||
TextView tvKeyAlgorithmOid = dview.findViewById(R.id.tvKeyAlgorithmOid);
|
||||
|
||||
tvCertificateInvalid.setVisibility(valid ? View.GONE : View.VISIBLE);
|
||||
tvCertificateReason.setText(reason);
|
||||
|
@ -10461,13 +10478,19 @@ public class FragmentMessages extends FragmentBase
|
|||
|
||||
if (!TextUtils.isEmpty(algo))
|
||||
algo = algo.replaceAll("(?i)With", "/");
|
||||
tvAlgorithm.setText(algo);
|
||||
|
||||
tvKeyAlgorithmTitle.setVisibility(info ? View.VISIBLE : View.GONE);
|
||||
tvAlgorithm.setText(algo);
|
||||
tvAlgorithmOid.setVisibility(info ? View.VISIBLE : View.GONE);
|
||||
tvAlgorithmOid.setText(algooid);
|
||||
|
||||
if (!TextUtils.isEmpty(keyalgo))
|
||||
keyalgo = keyalgo.replaceAll("(?i)With", "/");
|
||||
tvKeyAlgorithm.setVisibility(info ? View.VISIBLE : View.GONE);
|
||||
|
||||
tvKeyAlgorithmTitle.setVisibility(info && known ? View.VISIBLE : View.GONE);
|
||||
tvKeyAlgorithm.setVisibility(info && known ? View.VISIBLE : View.GONE);
|
||||
tvKeyAlgorithm.setText(keyalgo);
|
||||
tvKeyAlgorithmOid.setVisibility(info && known ? View.VISIBLE : View.GONE);
|
||||
tvKeyAlgorithmOid.setText(keyalgooid);
|
||||
|
||||
ibInfo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="test@example.com"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSenderTitle" />
|
||||
|
||||
|
@ -76,6 +77,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="test@example.com"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvEmailTitle" />
|
||||
|
||||
|
@ -120,6 +122,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="CN=test@example.com"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSubjectTitle" />
|
||||
|
||||
|
@ -139,6 +142,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="after"
|
||||
android:textAppearance="@android:style/TextAppearance.Small"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvBefore"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvValidityTitle" />
|
||||
|
@ -150,6 +154,7 @@
|
|||
android:gravity="end"
|
||||
android:text="before"
|
||||
android:textAppearance="@android:style/TextAppearance.Small"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tvAfter"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvValidityTitle" />
|
||||
|
@ -179,11 +184,23 @@
|
|||
android:id="@+id/tvAlgorithm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="SHA256withRSA"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:text="SHA256/RSA"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAlgorithmTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAlgorithmOid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1.2.840.113549.1.1.11"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAlgorithm" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvKeyAlgorithmTitle"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -198,9 +215,22 @@
|
|||
android:id="@+id/tvKeyAlgorithm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="SHA256withRSA"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:text="SHA256/RSA"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAlgorithmTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvKeyAlgorithmOid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1.2.840.113549.1.1.11"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvKeyAlgorithm" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
Loading…
Reference in a new issue