[Bug 62811] New: POI Encryption didn't work with 4.0.0 but did work with 3.17

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 62811] New: POI Encryption didn't work with 4.0.0 but did work with 3.17

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62811

            Bug ID: 62811
           Summary: POI Encryption didn't work with 4.0.0 but did work
                    with 3.17
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Created attachment 36193
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36193&action=edit
Example of file produced.

Using the code from https://poi.apache.org/encryption.html

POIFSFileSystem fs = new POIFSFileSystem();
EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile);
// EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile,
CipherAlgorithm.aes192, HashAlgorithm.sha384, -1, -1, null);

Encryptor enc = info.getEncryptor();
enc.confirmPassword("foobaa");

// Read in an existing OOXML file
OPCPackage opc = OPCPackage.open(new File("..."), PackageAccess.READ_WRITE);
OutputStream os = enc.getDataStream(fs);
opc.save(os);
opc.close();

// Write out the encrypted version
FileOutputStream fos = new FileOutputStream("...");
fs.writeFilesystem(fos);
fos.close();

This works fine with 3.17 but doesn't work with 4.0.0. It just creates a 2k
file that Microsoft Excel won't open.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 62811] POI Encryption didn't work with 4.0.0 but did work with 3.17

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62811

John Kleiser <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 62811] POI Encryption didn't work with 4.0.0 but did work with 3.17

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62811

Andreas Beeker <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Andreas Beeker <[hidden email]> ---
Before I try to reproduce it, please add that "os.close()" before calling
"fs.writeFilesystem()".

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 62811] POI Encryption didn't work with 4.0.0 but did work with 3.17

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62811

John Kleiser <[hidden email]> changed:

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

--- Comment #2 from John Kleiser <[hidden email]> ---
Yes adding os.close() as below resolves the issue. Thank you.

        POIFSFileSystem fs = new POIFSFileSystem( );
        EncryptionInfo info = new EncryptionInfo( EncryptionMode.agile );
        // EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile,
        // CipherAlgorithm.aes192, HashAlgorithm.sha384, -1, -1, null);

        Encryptor enc = info.getEncryptor( );
        enc.confirmPassword( "foobar" );

        // Read in an existing OOXML file
        OPCPackage opc = OPCPackage.open( new File( "input.xlsx" ),
PackageAccess.READ_WRITE );
        OutputStream os = enc.getDataStream( fs );
        opc.save( os );
        opc.close( );
        os.close( );

        // Write out the encrypted version
        FileOutputStream fos = new FileOutputStream( "output.xlsx" );
        fs.writeFilesystem( fos );
        fos.close( );

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 62811] POI Encryption didn't work with 4.0.0 but did work with 3.17

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62811

--- Comment #3 from Andreas Beeker <[hidden email]> ---
fixed the documentation via r1843348

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]