From f41a369ed382c41fbb8aa51ebde1919efa176dcf Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 30 Jul 2023 19:38:10 +0200 Subject: [PATCH] Fixed S/MIME sign+encrypt --- .../java/eu/faircode/email/FragmentCompose.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 3b31b57511..ca8f26d0d7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -4255,10 +4255,15 @@ public class FragmentCompose extends FragmentBase { // Build content File sinput = new File(tmp, draft.id + ".smime_sign"); - try (OutputStream os = new MessageHelper.CanonicalizingStream( - new BufferedOutputStream(new FileOutputStream(sinput)), EntityAttachment.SMIME_CONTENT, null)) { - bpContent.writeTo(os); - } + if (EntityMessage.SMIME_SIGNONLY.equals(type)) + try (OutputStream os = new MessageHelper.CanonicalizingStream( + new BufferedOutputStream(new FileOutputStream(sinput)), EntityAttachment.SMIME_CONTENT, null)) { + bpContent.writeTo(os); + } + else + try (FileOutputStream fos = new FileOutputStream(sinput)) { + bpContent.writeTo(fos); + } if (EntityMessage.SMIME_SIGNONLY.equals(type)) { EntityAttachment cattachment = new EntityAttachment();