Explain signed data

pull/174/head
M66B 6 years ago
parent a17ca96453
commit 610dc68817

@ -382,6 +382,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibJunk; private ImageButton ibJunk;
private ImageButton ibVerify; private ImageButton ibVerify;
private ImageButton ibDecrypt; private ImageButton ibDecrypt;
private TextView tvSignedData;
private TextView tvBody; private TextView tvBody;
private View wvBody; private View wvBody;
@ -571,6 +572,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibJunk = vsBody.findViewById(R.id.ibJunk); ibJunk = vsBody.findViewById(R.id.ibJunk);
ibVerify = vsBody.findViewById(R.id.ibVerify); ibVerify = vsBody.findViewById(R.id.ibVerify);
ibDecrypt = vsBody.findViewById(R.id.ibDecrypt); ibDecrypt = vsBody.findViewById(R.id.ibDecrypt);
tvSignedData = vsBody.findViewById(R.id.tvSignedData);
tvBody = vsBody.findViewById(R.id.tvBody); tvBody = vsBody.findViewById(R.id.tvBody);
wvBody = vsBody.findViewById(R.id.wvBody); wvBody = vsBody.findViewById(R.id.wvBody);
@ -1160,6 +1162,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibJunk.setVisibility(View.GONE); ibJunk.setVisibility(View.GONE);
ibVerify.setVisibility(View.GONE); ibVerify.setVisibility(View.GONE);
ibDecrypt.setVisibility(View.GONE); ibDecrypt.setVisibility(View.GONE);
tvSignedData.setVisibility(View.GONE);
tvBody.setVisibility(View.GONE); tvBody.setVisibility(View.GONE);
wvBody.setVisibility(View.GONE); wvBody.setVisibility(View.GONE);
@ -1284,8 +1287,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUnsubscribe.setVisibility(View.GONE); ibUnsubscribe.setVisibility(View.GONE);
ibJunk.setEnabled(false); ibJunk.setEnabled(false);
ibJunk.setVisibility(View.GONE); ibJunk.setVisibility(View.GONE);
ibDecrypt.setVisibility(View.GONE);
ibVerify.setVisibility(View.GONE); ibVerify.setVisibility(View.GONE);
ibDecrypt.setVisibility(View.GONE);
tvSignedData.setVisibility(View.GONE);
// Addresses // Addresses
ibExpanderAddress.setImageLevel(show_addresses ? 0 /* less */ : 1 /* more */); ibExpanderAddress.setImageLevel(show_addresses ? 0 /* less */ : 1 /* more */);
@ -1641,11 +1645,25 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (message == null || !message.content) if (message == null || !message.content)
return null; return null;
DB db = DB.getInstance(context);
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
boolean signed_data = false;
for (EntityAttachment attachment : attachments)
if (EntityAttachment.SMIME_SIGNED_DATA.equals(attachment.encryption)) {
signed_data = true;
break;
}
File file = message.getFile(context); File file = message.getFile(context);
if (!file.exists()) if (!file.exists())
return null; return null;
String body = Helper.readText(file); String body = Helper.readText(file);
if (!TextUtils.isEmpty(body))
signed_data = false;
args.putBoolean("signed_data", signed_data);
Document document = JsoupEx.parse(body); Document document = JsoupEx.parse(body);
// Check for inline encryption // Check for inline encryption
@ -1670,12 +1688,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
args.putBoolean("has_images", has_images); args.putBoolean("has_images", has_images);
// Download inline images // Download inline images
if (show_images) { if (show_images)
DB db = DB.getInstance(context);
try { try {
db.beginTransaction(); db.beginTransaction();
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (attachment.isInline() && attachment.isImage() && if (attachment.isInline() && attachment.isImage() &&
attachment.progress == null && !attachment.available) attachment.progress == null && !attachment.available)
@ -1685,7 +1701,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
}
// Format message // Format message
if (show_full) { if (show_full) {
@ -1838,6 +1853,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
EntityMessage.PGP_SIGNENCRYPT.equals(message.encrypt) || EntityMessage.PGP_SIGNENCRYPT.equals(message.encrypt) ||
EntityMessage.SMIME_SIGNENCRYPT.equals(message.encrypt) EntityMessage.SMIME_SIGNENCRYPT.equals(message.encrypt)
? View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE);
boolean signed_data = args.getBoolean("signed_data");
tvSignedData.setVisibility(signed_data ? View.VISIBLE : View.GONE);
} }
@Override @Override

@ -141,6 +141,17 @@
app:layout_constraintTop_toBottomOf="@id/vSeparatorBottom" app:layout_constraintTop_toBottomOf="@id/vSeparatorBottom"
app:srcCompat="@drawable/baseline_fullscreen_24" /> app:srcCompat="@drawable/baseline_fullscreen_24" />
<TextView
android:id="@+id/tvSignedData"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/title_signed_data"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibVerify" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/grpActions" android:id="@+id/grpActions"
android:layout_width="0dp" android:layout_width="0dp"

@ -797,6 +797,7 @@
<string name="title_resync">Resync</string> <string name="title_resync">Resync</string>
<string name="title_no_openpgp">OpenKeychain not found</string> <string name="title_no_openpgp">OpenKeychain not found</string>
<string name="title_user_interaction">Transferring to OpenKeychain</string> <string name="title_user_interaction">Transferring to OpenKeychain</string>
<string name="title_signed_data">Verify the signature to show the message text</string>
<string name="title_not_encrypted">Message is not signed or encrypted</string> <string name="title_not_encrypted">Message is not signed or encrypted</string>
<string name="title_reset_sign_key">Reset sign key</string> <string name="title_reset_sign_key">Reset sign key</string>

Loading…
Cancel
Save