mirror of
https://github.com/Ne-Lexa/php-zip.git
synced 2025-10-19 00:56:25 +02:00
fix incorrect time in archive
This commit is contained in:
@@ -155,12 +155,12 @@ class TraditionalPkwareEncryptionEngine implements CryptoEngine
|
||||
|
||||
if ($this->entry->getGeneralPurposeBitFlag(ZipEntry::GPBF_DATA_DESCRIPTOR)) {
|
||||
// compare against the file type from extended local headers
|
||||
$checkByte = ($this->entry->getTime() >> 8) & 0xff;
|
||||
$checkByte = ($this->entry->getDosTime() >> 8) & 0xff;
|
||||
} else {
|
||||
// compare against the CRC otherwise
|
||||
$checkByte = ($this->entry->getCrc() >> 24) & 0xff;
|
||||
}
|
||||
if ($headerBytes[11] !== $checkByte) {
|
||||
if ($byte !== $checkByte) {
|
||||
throw new ZipAuthenticationException("Bad password for entry " . $this->entry->getName());
|
||||
}
|
||||
|
||||
@@ -192,9 +192,9 @@ class TraditionalPkwareEncryptionEngine implements CryptoEngine
|
||||
*/
|
||||
public function encrypt($data)
|
||||
{
|
||||
$crc = ($this->entry->isDataDescriptorRequired() ?
|
||||
($this->entry->getTime() & 0x0000ffff) << 16 :
|
||||
$this->entry->getCrc());
|
||||
$crc = $this->entry->isDataDescriptorRequired() ?
|
||||
($this->entry->getDosTime() & 0x0000ffff) << 16 :
|
||||
$this->entry->getCrc();
|
||||
$headerBytes = CryptoUtil::randomBytes(self::STD_DEC_HDR_SIZE);
|
||||
|
||||
// Initialize again since the generated bytes were encrypted.
|
||||
|
Reference in New Issue
Block a user