You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2021/11/24 14:28:24 UTC

[Bug 65701] New: Encrypted excel file is corrupt if Saxon is default transformer and EncryptionMode.agile is used

https://bz.apache.org/bugzilla/show_bug.cgi?id=65701

            Bug ID: 65701
           Summary: Encrypted excel file is corrupt if Saxon is default
                    transformer and EncryptionMode.agile is used
           Product: POI
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POIFS
          Assignee: dev@poi.apache.org
          Reporter: bernhard.schuhmann@jedox.com
  Target Milestone: ---

Created attachment 38101
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38101&action=edit
Corrupt excel file - use 'test' as password.

If Saxon is on the classpath or javax.xml.transform.TransformerFactory is set
to net.sf.saxon.TransformerFactoryImpl and EncryptionMode.agile is used for
encryption, excel files generated by POI are corrupt and Excel fails to open
them.

The encryption info in the encrypted file has an empty namespace for element
KeyData: ...<keyData xmlns="" blockSize=...

This might be caused by org.apache.poi.poifs.crypt.agile.KeyData.write() (and
probably other places) using Document.createElement() instead of
Document.createElementNS().

This only seems to be an issue with Saxon as child nodes without namespace
don't inherit their parents' namespace. Other transformer implementations
(Xalan) behave differently, there's no xmlns="" in the generated XML and Excel
is able to open them.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65701] Encrypted excel file is corrupt if Saxon is default transformer and EncryptionMode.agile is used

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65701

--- Comment #4 from Bernhard Schuhmann <be...@jedox.com> ---
OK, was easier than expected (Gradle newbie) - tested with 5.2.0-SNAPSHOT from
trunk and my test case that failed with 5.1.0 is now working, i.e. Excel is now
again able to open the file.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65701] Encrypted excel file is corrupt if Saxon is default transformer and EncryptionMode.agile is used

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65701

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65701] Encrypted excel file is corrupt if Saxon is default transformer and EncryptionMode.agile is used

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65701

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
Added https://ci-builds.apache.org/job/POI/job/POI-DSL-saxon-test/ to run unit
tests with Saxon-HE on classpath

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65701] Encrypted excel file is corrupt if Saxon is default transformer and EncryptionMode.agile is used

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65701

--- Comment #2 from Bernhard Schuhmann <be...@jedox.com> ---
Brilliant, changes look good on paper - thanks for the swift response!

Will need a bit longer to test them - will report back.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65701] Encrypted excel file is corrupt if Saxon is default transformer and EncryptionMode.agile is used

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65701

--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
The changes seem to help in my testing but there is more work needed - I
created branches where the unit tests are un with saxon on the classpath. Lots
of tests fail before the 'fix' commit is added but all tests seem to pass with
saxon after the 'fix'.

https://github.com/pjfanning/poi/tree/saxon-test (test with saxon but without
the XML namespaces 'fix')

https://github.com/pjfanning/poi/tree/saxon-test2 (test with saxon and with the
XML namespaces 'fix')

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65701] Encrypted excel file is corrupt if Saxon is default transformer and EncryptionMode.agile is used

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65701

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
I added r1895303 - could you try the encryptor with these changes?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org