Zip
Zip copied to clipboard
Zip with password not work.
we create one zip file with a password but we can't access it with a password. can you help to solve out?
Same issue here ... seems to be a known issue, see #210.
I have tested the code and it seems like it works fine, try this test.
func testZipWithPassword() throws {
let imageURL1 = url(forResource: "3crBXeO", withExtension: "gif")!
let sandboxFolder = try autoRemovingSandbox()
let zipFilePath = sandboxFolder.appendingPathComponent("archive.zip")
try Zip.zipFiles(paths: [imageURL1], zipFilePath: zipFilePath, password: "Images", progress: nil)
XCTAssertTrue(FileManager.default.fileExists(atPath: zipFilePath.path))
XCTAssertThrowsError(try Zip.unzipFile(zipFilePath, destination: sandboxFolder, overwrite: true, password: "Imagess", progress: nil))
try Zip.unzipFile(zipFilePath, destination: sandboxFolder, overwrite: true, password: "Images", progress: nil)
XCTAssertTrue(FileManager.default.fileExists(atPath: sandboxFolder.path))
}
Comfirmed the output zip file cannot be unzipped using BetterZip or builtin Archive Utility on latest macOS.
// run on physical iOS device
// package version: 2.1.0
try Zip.zipData(archiveFiles: archiveFiles, zipFilePath: fileUrl, password: "foobar", compression: .DefaultCompression, progress: nil)
However, the contents (filenames and modification dates) of the zip file can be displayed in BetterZip.
Same issue here. Zip created with password can't be unzipped using the same password in macOS. However it can be unzipped using the unzip function by passing the password
The same, however possible to use https://online.b1.org/online
I am also having this issue with password protected archives; they can't be opened in macOS or Windows. Anyone know of any other Zip libraries? I tried using SSZipArchive but that also has issues.
I am using b1 free archiver for unpacking... or 7.zip - very old version for windows
I think it's the same issue as stated for #15
Zip
uses AES-256 encryption by default. But Finder, the standard Apple unarchiver, and many unarchivers do not support AES-256. The archive should open just fine with something like The Unarchiver or Keka.
Edit:
After seeing the comment from Natalia, I just generated another file and tried to uncompress it using The Unarchiver
and Keka
. Neither of them worked.
But somehow iZip Unarchiver
worked.
So yeah, it may not be related to the encryption method.
@startover205 I tried to unarchive with The Unarchiver app, and it doesn't work correctly. However, I can't find the option to set there the encryption algorithm, only the encoding, so maybe that's the issue.
End effect with Apple unarchiver: prompts for password in a loop. End effect with The Unvarchiver app: accepts password, then claims it was incorrect for each file. However, creates the archive folder with all proper files inside, but all the files are empty. End effect with Keka app: prompts for password, claims it's invalid.
What is more, if I use Keka to compress a file using AES-256 with the same password and then try to uncompress it using Keka - it works. While for the same file compressed also with AES-256 with the same password via Zip framework it does not work. This leads me to the conclusion that the issue is NOT AES-256.
Just unzipped a zipped file using same password used using "EncryptedZip2 for zip rar" available on AppStore mac
FYI. In my scenario, I prefer to have the option to restrict unzipping using any third-party software. When utilizing this library to zip a file, I aim for it to be exclusively unzip-able through this library. This adds an additional layer of complexity, particularly when dealing with secured files requiring a password for extraction. I acknowledge that this requirement has been raised as an issue, but I emphasize its importance as an optional feature.