SevenZipSharp
SevenZipSharp copied to clipboard
Unable to append new file to a 7z archive, created with EncryptHeaders = True
I am getting following exception while trying to append a new file to an existing password protected 7z archive.

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.