From 70a6c074794906d6e0d857db13a9bda7c5a39db8 Mon Sep 17 00:00:00 2001 From: nheiniger Date: Wed, 10 Sep 2025 10:46:00 +0200 Subject: [PATCH 1/2] Enable AES encryption when encrypting zip --- src/Runtime/LoopManager.cs | 2 +- src/Runtime/OutputWriter.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runtime/LoopManager.cs b/src/Runtime/LoopManager.cs index 268fd86..795ee33 100644 --- a/src/Runtime/LoopManager.cs +++ b/src/Runtime/LoopManager.cs @@ -100,7 +100,7 @@ private string ZipFiles() foreach (var entry in _filenames.Where(x => !string.IsNullOrEmpty(x))) { var fi = new FileInfo(entry); - var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length }; + var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length, AESKeySize = 256 }; zipStream.PutNextEntry(zipEntry); var buffer = new byte[4096]; diff --git a/src/Runtime/OutputWriter.cs b/src/Runtime/OutputWriter.cs index 70820af..8279be8 100644 --- a/src/Runtime/OutputWriter.cs +++ b/src/Runtime/OutputWriter.cs @@ -204,7 +204,7 @@ private string ZipFiles() foreach (var entry in fileList.Where(x => !string.IsNullOrEmpty(x))) { var fi = new FileInfo(entry); - var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length }; + var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length, AESKeySize = 256 }; zipStream.PutNextEntry(zipEntry); using (var fileStream = File.OpenRead(entry)) From ddc8ba60e089f1154f45c0ec63ab69b3a405d46f Mon Sep 17 00:00:00 2001 From: nheiniger Date: Wed, 10 Sep 2025 11:28:31 +0200 Subject: [PATCH 2/2] Fix issue after testing with no password too --- src/Runtime/LoopManager.cs | 3 ++- src/Runtime/OutputWriter.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Runtime/LoopManager.cs b/src/Runtime/LoopManager.cs index 795ee33..1032050 100644 --- a/src/Runtime/LoopManager.cs +++ b/src/Runtime/LoopManager.cs @@ -100,7 +100,8 @@ private string ZipFiles() foreach (var entry in _filenames.Where(x => !string.IsNullOrEmpty(x))) { var fi = new FileInfo(entry); - var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length, AESKeySize = 256 }; + var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length }; + if (_context.ZipPassword != null) zipEntry.AESKeySize = 256; zipStream.PutNextEntry(zipEntry); var buffer = new byte[4096]; diff --git a/src/Runtime/OutputWriter.cs b/src/Runtime/OutputWriter.cs index 8279be8..a998373 100644 --- a/src/Runtime/OutputWriter.cs +++ b/src/Runtime/OutputWriter.cs @@ -204,7 +204,8 @@ private string ZipFiles() foreach (var entry in fileList.Where(x => !string.IsNullOrEmpty(x))) { var fi = new FileInfo(entry); - var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length, AESKeySize = 256 }; + var zipEntry = new ZipEntry(fi.Name) { DateTime = fi.LastWriteTime, Size = fi.Length }; + if (_context.ZipPassword != null) zipEntry.AESKeySize = 256; zipStream.PutNextEntry(zipEntry); using (var fileStream = File.OpenRead(entry))