anonghosteam / outlook-privacy-plugin

Automatically exported from code.google.com/p/outlook-privacy-plugin
GNU General Public License v3.0
0 stars 1 forks source link

Support PGP-MIME #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Rather than require plain-text emails and what not we need support for PGP 
MIME.  This also makes attachment handling work better.

Original issue reported on code.google.com by m...@dejavusecurity.com on 30 Sep 2011 at 2:25

GoogleCodeExporter commented 8 years ago
Hello Mike

May I ask what the the current state of this issue is?
The changelog for revision 12 from Oct 5, 2011 states "Added support for 
decrypting PGP MIME messages."
However sending or reading MIME messages seems not to work, at least in Outlook 
2010.

Regards Holger

Original comment by holger...@gmail.com on 11 Jul 2012 at 5:58

GoogleCodeExporter commented 8 years ago
Hello again Mike

Thanks a lot for the effort you put into outlook-privacy-plugin.

I have just been looking at the code to figure out why handling of MIME 
messages is not working for me.

If I get it right, the important stuff happens in  
/trunk/OutlookPrivacyPlugin/OutlookPrivacyPlugin.cs. Looking at Revision 27 the 
function

private void Application_ItemSend(object Item, ref bool Cancel) on line 749

takes care of mails to be send. There seems to be no MIME handling yet.

On line 326 function

void mailItem_Open(Outlook.MailItem mailItem, ref bool Cancel)

handles opening of received mails. There seems to be code that detects MIME 
messages. Detection is done on line 463 and line 466 
if (attachment.FileName == "PGP_MIME version identification.dat")
if (attachment.FileName == "encrypted.asc")

However this detection seems not to work in the general case.

In Outlook PGP MIME encrypted messages send e.g. from Claws Mail 3.7.6 show as 
an empty message and two attachments named "Unbekannte Anlage xxxxx.dat" and 
"Unbekannte Anlage yyyyy.dat" where xxxxx and yyyyy are fife digit numbers 
varying from mail to mail. "Unbekannte Anlage" is German for "unknown 
attachment".

The first attachment file contains the text "Version: 1" which correspond to 
the content of the file whose existance the software checkes for on line 463.
The second file actually contains a plain text PGP encrypted file which 
decrypts to the actual MIME content of the mail containing the message and all 
attachments. This the content of the file your code is looking for on line 466, 
but does not find.

So it seems the names of the attachments are not a good way to check for PGP 
mime. Maybe it would be better to check the mail header for its content type 
which should possibly say something like:

X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: multipart/encrypted; boundary="Encrypt_/.....................";
 protocol="application/pgp-encrypted"

Then one still hat to figure out which of both files is the one containing the 
encrypted MIME data. Maybe this has to be done by checking the file content. 
Maybe it is also good enough for a first try to use the second attachment and 
improve on that later.

Maybe this would enhance the plugins support for receiving PGP mime messages.

Right now I do not have a Visual Studio on the machine I am working on so I 
can't make changes to the plugin and test them by myself. What are the exact 
tools required for working on the plugin. Anything special?

I might try to provide some more input to the plugin in the future. Would be 
nice to get sending of PGP MIME messages working.

Regards
Holger

Original comment by holger...@gmail.com on 11 Jul 2012 at 8:11

GoogleCodeExporter commented 8 years ago
I'm aware it's not a 100% implementation, but it did get things going with PGP 
Desktop, if not pretty.  I haven't found a good interface to see properties for 
the multipart mime parts yet.  The interface that should work seems to be 
missing the content.  I have found some C++ code that was able to use MAPI 
API's to get this information.

The first chance I will have to spend time on this will be in Aug.  You welcome 
to take a go at it and submit a patch.

Original comment by m...@dejavusecurity.com on 11 Jul 2012 at 9:51

GoogleCodeExporter commented 8 years ago
I was just trying to find out how to access the header of a mail in outlook.

What I found from [1] you need something like the following code to get a 
string with all the header information.

(string) mailItem.PropertyAccessor.GetProperty 
("http://schemas.microsoft.com/mapi/proptag/0x007D001E";)

Later on I found an implementation [2] that hides some of the complexity and 
lets you just querry for a property. Maybe this is usefull.

So if there is a property named "Content-Type:" that contains the strings 
"multipart" and "pgp" or maybe even "pgp-encrypted" we have a PGP-Mime message 
which should give a true for the test on line 463 in 
OutlookPrivacyPlugin.cs:r27.

Next would be to check if there are two attachments and store the second into 
the variable encryptedMime on line 667 of OutlookPrivacyPlugin.cs:r27.

I will try to contribute a patch. Not sure if I manage to do so before August.

Can you give me some hint about how to set up the required build environment 
for the plugin?

[1] http://msdn.microsoft.com/en-us/library/gg622917.aspx
[2] http://www.lessanvaezi.com/email-headers-from-outlook-mailitem/

Original comment by holger...@gmail.com on 12 Jul 2012 at 8:57

GoogleCodeExporter commented 8 years ago

Original comment by m...@dejavusecurity.com on 4 Sep 2012 at 11:58

GoogleCodeExporter commented 8 years ago
Hello Mike,

it took me longer than I thought but attached you find a patch for the changes 
I proposed in my comment from Jun 12, 2012. It adds a Headers Extension 
(MailItemExtension.cs) to the MailItem as described by Lessan Vaezi [1] (I'm 
not yet sure about the license of this code).

I then expanded "OutlookPrivacyPlugin.cs" Version Beta-19 from Line 459 to look 
for "pgp" in the "Content-Type" Header. If found I take the second attachment 
as "encryptedMime".

So far the code works for all PGP-MIME encrypted mails I could test. I do not 
yet consider it as a good solution, but maybe it's a start for supporting 
PGP-MIME.

[1] http://www.lessanvaezi.com/email-headers-from-outlook-mailitem/

Original comment by holger...@gmail.com on 22 Oct 2012 at 12:34

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 131 has been merged into this issue.

Original comment by m...@dejavusecurity.com on 5 Apr 2014 at 7:09