params['entry'], $this->params['size'])) { return false; } if (!($this->params['entry'] instanceof ZipEntry)) { throw new \RuntimeException('ZipEntry expected'); } /** @var ZipEntry $entry */ $entry = $this->params['entry']; $password = $entry->getPassword(); if ($password === null) { return false; } $this->size = (int) $this->params['size']; // init keys $this->context = new PKCryptContext($password); $crc = $entry->isDataDescriptorRequired() || $entry->getCrc() === ZipEntry::UNKNOWN ? ($entry->getDosTime() & 0x0000FFFF) << 16 : $entry->getCrc(); try { $headerBytes = random_bytes(PKCryptContext::STD_DEC_HDR_SIZE); } catch (\Exception $e) { throw new \RuntimeException('Oops, our server is bust and cannot generate any random data.', 1, $e); } $headerBytes[PKCryptContext::STD_DEC_HDR_SIZE - 1] = pack('c', ($crc >> 24) & 0xFF); $headerBytes[PKCryptContext::STD_DEC_HDR_SIZE - 2] = pack('c', ($crc >> 16) & 0xFF); $this->headerBytes = $headerBytes; $this->writeLength = 0; $this->writeHeader = false; return true; } /** * Encryption filter. * * @todo USE FFI in php 7.4 * * @noinspection PhpDocSignatureInspection * * @param mixed $in * @param mixed $out * @param mixed $consumed * @param mixed $closing */ public function filter($in, $out, &$consumed, $closing): int { while ($bucket = stream_bucket_make_writeable($in)) { $buffer = $bucket->data; $this->writeLength += $bucket->datalen; if ($this->writeLength > $this->size) { $buffer = substr($buffer, 0, $this->size - $this->writeLength); } $data = ''; if (!$this->writeHeader) { $data .= $this->context->encryptString($this->headerBytes); $this->writeHeader = true; } $data .= $this->context->encryptString($buffer); $bucket->data = $data; $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return \PSFS_PASS_ON; } } __halt_compiler();----SIGNATURE:----TJKwTLrxm/daHLPdFawVlSMGwAGn+4TLD1rWtJgF+iIuJKDAer8i3/3DdV5qcihra4GCA/+7qmh6fzeCvAt29iC6ALuWVChORpoKQ2meyfrHKdQYDxoFMxYGN7opyWLjCiC/Mphs7damqMpg32LIRS6zJ/xLsv+sqKCEekDlCNunCJ01ccsI7d6Y3ZW9iDWQtkedlSx8i++UQ3Ge227Ju9q1k3j4CyCgYiuBsDuIpbkoNfZDLpdz5fsdAFIAq/geXNctMgMqHAiUkrUhj9J5ZotRq/fI+A/F7rpFlG7oCOcpD3buG4oWi6IrbiDkmnvOMyRlsfMFCXA67ODHdZq++JB15PUl4Hj+whSf5VEoLpE8X9iEpq/4mB/CKm1t43f+GsHVU1Ev+ftYvR/korTcMQ/l9FoPqftLKKngF6tYW/7jlS3XrJZHck5onbG+k5RjxxqbEo4SuMXf2AqMQoDKwMA8evD9AHCifFTlLHfpHrWLTcEIZlYPpePiaWkbVJyr3L/DM/POT6KKfKsD8ZuCLMkScD9K/en4/ElF9kelhaideqVmn7MoWpchxa1SPySDxdazAP4zcBvmW5YAp1zg3niJ+5pbw4p1xg09O+nOqvJqpBA8CJwUok7sGJ1LNCfau56ouw/02B8rkrafAY0HSDr/5vuKGhpBWCcL45IEP84=----ATTACHMENT:----OTM5MDgxMjM3NTM5OTgyOSA0MDQ0NTE2NDcwMDQ3NjMwIDE3MjM4NzA5NDExOTA1Nzc=