Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Unable to append new file to a 7z archive, created with EncryptHeaders = True #153

Open
amarendrabiorad opened this issue Jan 21, 2022 · 0 comments

Comments

@amarendrabiorad
Copy link

I am getting following exception while trying to append a new file to an existing password protected 7z archive.

image

Exception occurs while invoking CompressFilesEncrypted method in append mode, as shown in below snippet.

 var compressor = new new SevenZipCompressor(); 
 compressor.CompressionMode = CompressionMode.Append;
 compressor.CompressFilesEncrypted(zipFileName, fileID, fileToBeAdded);

The 7z archive is already created using below code.

var compressor = new SevenZipCompressor()
            {
                ArchiveFormat = OutArchiveFormat.SevenZip,
                CompressionMethod = CompressionMethod.Lzma2,
                CompressionLevel = CompressionLevel.Normal,
                EncryptHeaders = true,
            };
            compressor.CompressDirectory(folder, zipFileName, password);

Important point to notice, I am not facing the above issue if archive is created with EncryptHeaders = false;

A similar issue had been raised and already fixed for ModifyArchive function.... Here is a link to that issue.

@amarendrabiorad amarendrabiorad changed the title Unable to append new file to an archive, created with EncryptHeaders = True Unable to append new file to a 7z archive, created with EncryptHeaders = True Jan 21, 2022
amarendrabiorad added a commit to amarendrabiorad/SevenZipSharp that referenced this issue Jan 23, 2022
Fix for issue: squid-box#153. 
Code changes to update Password in SevenZipCompressor for append operations. 
This fix is based on code changes done under: squid-box#20
amarendrabiorad added a commit to amarendrabiorad/SevenZipSharp that referenced this issue Jan 24, 2022
Fix for issue: squid-box#153. 
Code changes to update Password in SevenZipCompressor for append operations. 
This fix is based on code changes done under: squid-box#20
doug24 added a commit to doug24/dnGrep that referenced this issue Mar 31, 2023
Code changes to update Password in SevenZipCompressor for append operations.
cloned from squid-box commit e3733826d4d1cda352a0de2683e4cc1311d9089c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant