Bug 58133 - Agile encryption - wrong checksum calculation
Summary: Agile encryption - wrong checksum calculation
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2015-07-13 11:07 UTC by Jason Harrop
Modified: 2015-07-14 00:14 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Jason Harrop 2015-07-13 11:07:43 UTC
Using trunk of today (latest commit 2f8aa558b344f5e891e99cd020a0305d9a6e8e62), opening in Word 2010 a docx encrypted using POI gives the prompt:

"This file may have been tampered with or corrupted and the contents should not be trusted.  Do you wish to continue opening this file?"

This is the first time I've tried doing this, so I'm not sure whether this is a regression or not.

Code to repro:

         POIFSFileSystem fs = new POIFSFileSystem();
         EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile);

         Encryptor enc = info.getEncryptor();

         OPCPackage opc = OPCPackage.open(new File(inputfilepath), PackageAccess.READ_WRITE);
         OutputStream os = enc.getDataStream(fs);

         FileOutputStream fos = new FileOutputStream(new File(outputfilepath));

Input a simple hello world docx (I created one in Word 2010).
Comment 1 Andreas Beeker 2015-07-13 21:27:40 UTC
I guess this error was introduced by r1647867

I'm onto it ...
Comment 2 Andreas Beeker 2015-07-13 22:55:04 UTC
fixed with r1690837

Actually this was only a test, if anyone uses the encryption code (facepalm)
This bug was introduced right after 3.11 final came out and affected the
checksum calculation.

Please confirm it, as I currently have only Libre Office, Excel Viewer (can't process agile encryption, only standard encryption) and Word Viewer available...
Comment 3 Jason Harrop 2015-07-14 00:14:16 UTC
Fix confirmed. Thank you!