Unable to zip and encrypt 100MB file using Rebex C#

91 Views Asked by At

We have a simple code that tries zip and encrypt a file. That code works perfectly for the moderately size files. However, when we try to encrypt and zip the file that has the size of 100MB, the contents of the file are lost in a process and the Rebex ends up zipping an empty file.

Is there a catch for handling large files?

Thank you in advance, here is our code

using (ZipArchive zip = new ZipArchive(ZipFilePath, ArchiveOpenMode.Create))
{
    // Set the Password first
    zip.Password = strUserPIN;

    // Change the default Encryption algorithm 
    zip.EncryptionAlgorithm = useAes256EncryptionForWinZip == "YES" ?
        Rebex.IO.Compression.EncryptionAlgorithm.Aes256 : Rebex.IO.Compression.EncryptionAlgorithm.Zip20;


    // Add the file to newly created "files" folder within the zip file
    zip.AddFile(Temp_BPI_SaveLocation + strDataFileWithTimeStamp, @"\files\");

    //Save the Zip file
    zip.Save();

    // cloase the zip file
    zip.Close();

}
1

There are 1 best solutions below

0
On

No, there is only 4GB size limit for standard ZIP format. There should be no issues for 100MB files.

The behavior you are observing looks strange. Can you please help us to reproduce the issue?
We can discuss it in more details at https://forum.rebex.net/13878/unable-to-zip-and-encrypt-100-mb-file. I will update this answer when the cause of the issue is found.

UPDATE:

Currently working workaround is to use use the AddFile(Stream, string) instead the AddFile(string, string) overload (issue is still under review on vendor's site).