Add filenames for our mime parts
authorAndre Heinecke <aheinecke@gnupg.org>
Tue, 19 Mar 2019 08:51:13 +0000 (09:51 +0100)
committerAndre Heinecke <aheinecke@gnupg.org>
Tue, 19 Mar 2019 08:55:19 +0000 (09:55 +0100)
* src/cryptcontroller.cpp (create_sign_attach): Add file name
for signatures.
* src/mimemaker.cpp (create_top_encryption_header): Add file name
for OpenPGP encrypted.
* src/mimemaker.h: Add defines for filenames.

--
This makes it look nicer if a client does not support PGP/MIME
and you can even open the message with Kleopatra.

GnuPG-Bug-Id: T4258

src/cryptcontroller.cpp
src/mimemaker.cpp
src/mimemaker.h

index b658e8e..484707c 100644 (file)
@@ -913,13 +913,17 @@ create_sign_attach (sink_t sink, protocol_t protocol,
   if (protocol == PROTOCOL_OPENPGP)
     {
       rc = write_string (sink,
-                         "Content-Type: application/pgp-signature\r\n");
+                         "Content-Type: application/pgp-signature;\r\n"
+                         "\tname=\"" OPENPGP_SIG_NAME "\"\r\n"
+                         "Content-Transfer-Encoding: 7Bit\r\n");
     }
   else
     {
       rc = write_string (sink,
                          "Content-Transfer-Encoding: base64\r\n"
-                         "Content-Type: application/pkcs7-signature\r\n");
+                         "Content-Type: application/pkcs7-signature\r\n"
+                         "Content-Disposition: inline;\r\n"
+                         "\tfilename=\"" SMIME_SIG_NAME "\"\r\n");
       /* rc = write_string (sink, */
       /*                    "Content-Type: application/x-pkcs7-signature\r\n" */
       /*                    "\tname=\"smime.p7s\"\r\n" */
index be51ae6..d806657 100644 (file)
@@ -1544,6 +1544,9 @@ create_top_encryption_header (sink_t sink, protocol_t protocol, char *boundary,
         return rc;
       rc = write_multistring (sink,
                               "Content-Type: application/octet-stream\r\n"
+                              "Content-Disposition: inline;\r\n"
+                              "\tfilename=\"" OPENPGP_ENC_NAME "\"\r\n"
+                              "Content-Transfer-Encoding: 7Bit\r\n"
                               "\r\n", NULL);
      }
 
index 047d7bf..621f1f0 100644 (file)
@@ -30,6 +30,11 @@ extern "C" {
 #endif
 #endif
 
+/* Names for our attachments */
+#define OPENPGP_ENC_NAME "openpgp-encrypted-message.asc"
+#define OPENPGP_SIG_NAME "openpgp-digital-signature.asc"
+#define SMIME_SIG_NAME "smime.p7s"
+
 /* The object we use instead of IStream.  It allows us to have a
    callback method for output and thus for processing stuff
    recursively.  */