Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 640322d4 authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

add "name" parameter to signature content-type header

parent 4e17fdf1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -285,7 +285,8 @@ public class PgpMessageBuilder extends MessageBuilder {
        multipartSigned.setSubType("signed");
        multipartSigned.addBodyPart(signedBodyPart);
        multipartSigned.addBodyPart(
                new MimeBodyPart(new BinaryMemoryBody(signedData, MimeUtil.ENC_7BIT), "application/pgp-signature"));
                new MimeBodyPart(new BinaryMemoryBody(signedData, MimeUtil.ENC_7BIT),
                        "application/pgp-signature; name=\"signature.asc\""));
        MimeMessageHelper.setBody(currentProcessedMimeMessage, multipartSigned);

        String contentType = String.format(
+5 −2
Original line number Diff line number Diff line
@@ -154,8 +154,11 @@ public class PgpMessageBuilderTest {
        assertContentOfBodyPartEquals("content must match the message text", contentBodyPart, TEST_MESSAGE_TEXT);

        BodyPart signatureBodyPart = multipart.getBodyPart(1);
        Assert.assertEquals("second part must be pgp signature",
                "application/pgp-signature", signatureBodyPart.getContentType());
        String contentType = signatureBodyPart.getContentType();
        Assert.assertEquals("second part must be pgp signature", "application/pgp-signature",
                MimeUtility.getHeaderParameter(contentType, null));
        Assert.assertEquals("second part must be called signature.asc", "signature.asc",
                MimeUtility.getHeaderParameter(contentType, "name"));
        assertContentOfBodyPartEquals("content must match the supplied detached signature",
                signatureBodyPart, new byte[] { 1, 2, 3 });
    }