php-zip icon indicating copy to clipboard operation
php-zip copied to clipboard

Password madness

Open zolex opened this issue 6 years ago • 1 comments

Q A
Library version(s) affected: 3.1.9
PHP version(s): 7.2
OS (with bit depth): Win 10 x64 (A) + debian stretch x64 (b)

Description
for sys A no traditional encrypted password is working at all when creating a new archive. it sets a password, and when then trying to extract the archive (with any tool like winrar, winzip, windows explorer ) the given password does not work.

for sys B the behaviour is quite similar, but here passwords without special hcars do work and passwords with special chars do not work when trying to extract the created archive.

How to reproduce
$password = 'whatever'; (new ZipFile) ->addFromString($path, $xml) ->setPassword($password, ZipFileInterface::ENCRYPTION_METHOD_TRADITIONAL) ->saveAsFile($zipPath) ->close();

zolex avatar Dec 03 '18 16:12 zolex

Windows supports only PKWARE and ZipCrypto password encrypted ZIP files.

Try this:

use PhpZip\Constants\ZipEncryptionMethod;
// ...

$zipFile->setPassword('password', ZipEncryptionMethod::PKWARE);

odan avatar Aug 22 '21 19:08 odan