public async Task WriteZipStreamAsync() { using var ms = new MemoryStream(); using (var outStream = new ZipOutputStream(ms) { IsStreamOwner = false }) { await outStream.PutNextEntryAsync(new ZipEntry("FirstFile")); await Utils.WriteDummyDataAsync(outStream, 12); await outStream.PutNextEntryAsync(new ZipEntry("SecondFile")); await Utils.WriteDummyDataAsync(outStream, 12); await outStream.FinishAsync(CancellationToken.None); } ZipTesting.AssertValidZip(ms); }
public async Task WriteZipStreamWithZipCryptoAsync() { using var ms = new MemoryStream(); var password = "******"; using (var outStream = new ZipOutputStream(ms) { IsStreamOwner = false, Password = password }) { await outStream.PutNextEntryAsync(new ZipEntry("FirstFile"){ AESKeySize = 0 }); await Utils.WriteDummyDataAsync(outStream, 12); await outStream.PutNextEntryAsync(new ZipEntry("SecondFile"){ AESKeySize = 0 }); await Utils.WriteDummyDataAsync(outStream, 12); await outStream.FinishAsync(CancellationToken.None); } ZipTesting.AssertValidZip(ms, password, false); }