Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip with password not work. #215

Open
pethanihiten opened this issue Feb 19, 2021 · 11 comments
Open

Zip with password not work. #215

pethanihiten opened this issue Feb 19, 2021 · 11 comments

Comments

@pethanihiten
Copy link

we create one zip file with a password but we can't access it with a password. can you help to solve out?

@Jeehut
Copy link

Jeehut commented Feb 23, 2021

Same issue here ... seems to be a known issue, see #210.

@alrocha
Copy link

alrocha commented Mar 19, 2021

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))
    }

@gongzhang
Copy link

gongzhang commented Mar 23, 2021

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.

@kattaliraees
Copy link

kattaliraees commented Apr 19, 2022

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

@evgzor
Copy link

evgzor commented May 3, 2022

The same, however possible to use https://online.b1.org/online

@stevenamani
Copy link

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.

@evgzor
Copy link

evgzor commented Aug 11, 2022

I am using b1 free archiver for unpacking... or 7.zip - very old version for windows

@startover205
Copy link

startover205 commented Jan 3, 2023

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.

@natalia-osa
Copy link

natalia-osa commented Jan 16, 2023

@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.

@mawais91
Copy link

Just unzipped a zipped file using same password used using "EncryptedZip2 for zip rar" available on AppStore mac

@waelsaad
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests