[gmime-devel] g_mime_part_get_openpgp_data () and Content-Transfer-Encoding: base64



hey Jeff and other GMime folks--

I've been working on adding support for decryption of PGP inline
messages over on notmuch [0], but i notice that at least for some
e-mails it seems that they are not detected.

In particular, some of my contacts are sending me inline PGP encrypted
messages through some chain of MUAs/webmail/MTAs that automagically
base64-encode any text the human supplies.

As a result, a message that should look like this:

~~~~~~~~~~~~~~
Content-Type: text/plain

-----BEGIN PGP MESSAGE-----

hQIMA+OjIilEmwNQAQ//XadAsPB3ysMzcj3uE//V4XANwkfW4so9SUwspANOu9iP
JVXpLCBMsbICErU9bvTp6QX4WsFH5DxITu/7L1YNAsgZi436cNB3E2dE0ksRMuwo
+6j7ZECqYkdw6sPJ8VrEObaGmLjChFySewZiGmSuLUYU3UAs63F09iVuWQAh5hhl
3aObvNyr5NwPx5KwRa1p8FK7RCJz0g7clVeqtEvsVRSZcBZ58dr5a75Hf02kCb0o
kVETBrH3kQE4CaWYBc6uFHBHp8PcSVkjfd4xGPDPrEAohyfNmReiG31YhZb5uSDo
PEVdkd361DlW5P3dGxyvqlj8GadgR9bASgwX8I52MekFyFI8ktxEk9CIU3zNmjGr
crsQmcjaYUE0lyY+vU3ni95WvKgSoZsmSRJjK6cEsGwoTfhMI/lv5B/nsLiK7G7U
4FaBvyoAllq/hm5JiEGQDR56Hb3U+dwjP12N880DMWL3TrcMcxkaxOExefdWz1+/
uK1vOGMLQpI8T0jas0CFKSUyj4DXzHK1uiGbm1ISSv0rNggoMlI3RydsSPK5jO+w
rUz+2caZEPk75+lCx0jDq5LHwMfTY4Vz6phVj33yypcIYmhAtReTYeH6isJu3kxb
jmUOl9YQYnsrGGIx3/5b/TOEKU78bQ8qLPrrqBj313tW1nMCnJI9rlA1rfmfyTPS
SAHXMnrkzlT7MHvpzi6xZ88zT1CwTTxr3zXc7yFLK/EMpr1G5MDq0DZGQAKYpTnx
mZsSG0fGMWmmIP5/pMCB+ISadEpqQv2SQg==
=z2wP
-----END PGP MESSAGE-----
~~~~~~~~~~~~~~


ends up looking like this when you peek at the bytes in the raw message
body itself:

~~~~~~~~~~~~~~
Content-Type: text/plain
Content-Transfer-Encoding: base64

LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpoUUlNQStPaklpbEVtd05RQVEvL1hhZEFzUEIz
eXNNemNqM3VFLy9WNFhBTndrZlc0c285U1V3c3BBTk91OWlQCkpWWHBMQ0JNc2JJQ0VyVTlidlRw
NlFYNFdzRkg1RHhJVHUvN0wxWU5Bc2daaTQzNmNOQjNFMmRFMGtzUk11d28KKzZqN1pFQ3FZa2R3
NnNQSjhWckVPYmFHbUxqQ2hGeVNld1ppR21TdUxVWVUzVUFzNjNGMDlpVnVXUUFoNWhobAozYU9i
dk55cjVOd1B4NUt3UmExcDhGSzdSQ0p6MGc3Y2xWZXF0RXZzVlJTWmNCWjU4ZHI1YTc1SGYwMmtD
YjBvCmtWRVRCckgza1FFNENhV1lCYzZ1RkhCSHA4UGNTVmtqZmQ0eEdQRFByRUFvaHlmTm1SZWlH
MzFZaFpiNXVTRG8KUEVWZGtkMzYxRGxXNVAzZEd4eXZxbGo4R2FkZ1I5YkFTZ3dYOEk1Mk1la0Z5
Rkk4a3R4RWs5Q0lVM3pObWpHcgpjcnNRbWNqYVlVRTBseVkrdlUzbmk5NVd2S2dTb1pzbVNSSmpL
NmNFc0d3b1RmaE1JL2x2NUIvbnNMaUs3RzdVCjRGYUJ2eW9BbGxxL2htNUppRUdRRFI1NkhiM1Ur
ZHdqUDEyTjg4MERNV0wzVHJjTWN4a2F4T0V4ZWZkV3oxKy8KdUsxdk9HTUxRcEk4VDBqYXMwQ0ZL
U1V5ajREWHpISzF1aUdibTFJU1N2MHJOZ2dvTWxJM1J5ZHNTUEs1ak8rdwpyVXorMmNhWkVQazc1
K2xDeDBqRHE1TEh3TWZUWTRWejZwaFZqMzN5eXBjSVltaEF0UmVUWWVINmlzSnUza3hiCmptVU9s
OVlRWW5zckdHSXgzLzViL1RPRUtVNzhiUThxTFBycnFCajMxM3RXMW5NQ25KSTlybEExcmZtZnlU
UFMKU0FIWE1ucmt6bFQ3TUh2cHppNnhaODh6VDFDd1RUeHIzelhjN3lGTEsvRU1wcjFHNU1EcTBE
WkdRQUtZcFRueAptWnNTRzBmR01XbW1JUDUvcE1DQitJU2FkRXBxUXYyU1FnPT0KPXoyd1AKLS0t
LS1FTkQgUEdQIE1FU1NBR0UtLS0tLQo=
~~~~~~~~~~~~~~

Consequently, i think g_mime_part_get_openpgp_data returns
GMIME_OPENPGP_DATA_NONE instead of GMIME_OPENPGP_DATA_ENCRYPTED, so my
work for notmuch doesn't actually recognize that these parts have inline
PGP encrypted data in them.

I'm pretty well convinced that inline PGP is a bad idea generally, so i
don't want GMime to twist itself into knots about this.  but if there's
some obvious fix that you see that would also catch these particular
messages, i'd be happy to know about it.

Any ideas?  is my analysis wrong somehow?

          --dkg

[0] https://notmuchmail.org/pipermail/notmuch/2017/025987.html and
subsequent messages in that thread

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]