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 2018/10/09 13:54:46 UTC

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

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: dev@poi.apache.org
          Reporter: john.kleiser@gmail.com
  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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


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

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

John Kleiser <jo...@gmail.com> changed:

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

--- Comment #2 from John Kleiser <jo...@gmail.com> ---
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


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

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

Andreas Beeker <ki...@apache.org> changed:

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

--- Comment #1 from Andreas Beeker <ki...@apache.org> ---
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


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

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

John Kleiser <jo...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
                 CC|                            |john.kleiser@gmail.com

-- 
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 62811] POI Encryption didn't work with 4.0.0 but did work with 3.17

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

--- Comment #3 from Andreas Beeker <ki...@apache.org> ---
fixed the documentation via r1843348

-- 
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