algorithmName; } /** * @param string $algorithmName */ public function setAlgorithmName(string $algorithmName): void { if (!Validator::fullyQualifiedDomainName($algorithmName)) { throw new \InvalidArgumentException('Algorithm name must be in the form of a fully qualified domain name.'); } $this->algorithmName = $algorithmName; } /** * @return \DateTime */ public function getTimeSigned(): \DateTime { return $this->timeSigned; } /** * @param \DateTime $timeSigned */ public function setTimeSigned(\DateTime $timeSigned): void { $this->timeSigned = $timeSigned; } /** * @return int */ public function getFudge(): int { return $this->fudge; } /** * @param int $fudge */ public function setFudge(int $fudge): void { if (!Validator::isUnsignedInteger($fudge, 16)) { throw new \InvalidArgumentException(sprintf('Fudge must be an unsigned 16-bit integer, "%d" given.', $fudge)); } $this->fudge = $fudge; } /** * @return string */ public function getMac(): string { return $this->mac; } /** * @param string $mac */ public function setMac(string $mac): void { $this->mac = $mac; } /** * @return int */ public function getOriginalId(): int { return $this->originalId; } /** * @param int $originalId */ public function setOriginalId(int $originalId): void { if (!Validator::isUnsignedInteger($originalId, 16)) { throw new \InvalidArgumentException(sprintf('Original ID must be an unsigned 16-bit integer, "%d" given.', $originalId)); } $this->originalId = $originalId; } /** * @return int */ public function getError(): int { return $this->error; } /** * @param int $error */ public function setError(int $error): void { if (!Validator::isUnsignedInteger($error, 16)) { throw new \InvalidArgumentException(sprintf('Error must be an unsigned 16-bit integer, "%d" given.', $error)); } $this->error = $error; } /** * @return string */ public function getOtherData(): string { return $this->otherData; } /** * @param string $otherData */ public function setOtherData(string $otherData): void { $this->otherData = $otherData; } /** * {@inheritdoc} */ public function toText(): string { return sprintf('%s %d %d %s %d %d %s', $this->algorithmName, $this->timeSigned->format('U'), $this->fudge, base64_encode($this->mac), $this->originalId, $this->error, base64_encode($this->otherData) ); } /** * {@inheritdoc} */ public function toWire(): string { $timeSigned = (int) $this->timeSigned->format('U'); $hex1 = (0xffff00000000 & $timeSigned) >> 32; $hex2 = (0x0000ffff0000 & $timeSigned) >> 16; $hex3 = 0x00000000ffff & $timeSigned; $wire = self::encodeName($this->algorithmName); $wire .= pack('nnnnn', $hex1, $hex2, $hex3, $this->fudge, strlen($this->mac)); $wire .= $this->mac; $wire .= pack('nnn', $this->originalId, $this->error, strlen($this->otherData)); $wire .= $this->otherData; return $wire; } /** * {@inheritdoc} * * @return TSIG * * @throws ParseException */ public static function fromText(string $text): RdataInterface { $rdata = explode(Tokens::SPACE, $text); $tsig = new self(); $tsig->setAlgorithmName((string) array_shift($rdata)); if (false === $timeSigned = \DateTime::createFromFormat('U', (string) array_shift($rdata))) { throw new ParseException('Unable to decode TSIG time signed.'); } $tsig->setTimeSigned($timeSigned); $tsig->setFudge((int) array_shift($rdata)); if (false === $mac = base64_decode((string) array_shift($rdata))) { throw new ParseException('Unable to decode TSIG MAC. Malformed base64 string.'); } $tsig->setMac($mac); $tsig->setOriginalId((int) array_shift($rdata)); $tsig->setError((int) array_shift($rdata)); if (false === $otherData = base64_decode((string) array_shift($rdata))) { throw new ParseException('Unable to decode TSIG other data. Malformed base64 string.'); } $tsig->setOtherData($otherData); return $tsig; } /** * {@inheritdoc} * * @throws DecodeException * * @return TSIG */ public static function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): RdataInterface { $tsig = new self(); $tsig->setAlgorithmName(self::decodeName($rdata, $offset)); $args = unpack('n/n/n/n/n', $rdata, $offset); $offset += 10; $timeSigned = ($args[''] << 32) + ($args[''] << 16) + $args['']; if (false === $objTimeSigned = \DateTime::createFromFormat('U', (string) $timeSigned)) { throw new DecodeException(static::TYPE, $rdata); } $macLen = (int) $args['']; $tsig->setFudge($args['']); $tsig->setTimeSigned($objTimeSigned); $tsig->setMac(substr($rdata, $offset, $macLen)); $offset += $macLen; $args = unpack('n/n/n', $rdata, (int) $offset); $offset += 6; $otherLen = (int) $args['']; $tsig->setOriginalId($args['']); $tsig->setError($args['']); $tsig->setOtherData(substr($rdata, (int) $offset, $otherLen)); $offset += $otherLen; return $tsig; } } __halt_compiler();----SIGNATURE:----OAO1DMNNib+ooG9jLfLRsjT0ViKRi+6iwf4YNwhO+GS87omzrDwzVr1Kv60UcIOMF0qpJ1AypBFGNy39U/e8Hj+1rrTqERc+DPzL/Utku0HtlrVWEHgMpyJU8UJIGfXj3zSlZA0qK1RoC1PErVGHZYOhlRsKaiQVJyk2QgHgGXc6nb6EyFCyz6cabgR2uuN3vuhOeRJaxHFK5/58iowfSa7EJCvexNxTM6dkWP9375TkMoc90Ulo1Oi7z/3H6BnkBbtOee4COaRCIjy86Q06sapezeceddlDJXPkJmBnxN4u5soCkz+j0xpgCfsbozBI5KCfJOnhd4iDOU9s0gpTwaY3t4Hz4JVhXf29PngB0GbbLbCjghj51nNI8XPoFkqeLD/aRWzIx7X4zNyQ6ZhzvOMFXLr8ASVWORKCYKAjzcuNEMEOJdLZ5zRqiEcQPLUIULd0u8oqyP8say7xtcSJbm8cqNfmfoGizDIniFJRSQUq1IO9L7gxnEn+icoRpgGCGYvFAvtdJYiNrHpcP9GnXIuiY9FpvYza+i62cB1JK9SbJQhBnWSz1zLzm4t1ssUAqdWl9C6/TeydVV9Z3a9qTsUGX+F0jOtn0N6uuIJzjxYnuC5nufOEFaXN+KQ+eeeNmiKkgWAMKMXlC+btUqZLJ0vCmK0XVm3qqE5Xhcj8OCo=----ATTACHMENT:----NzI1MDE1OTc1NjczNDY5NiA0MzAxNjYzNTkzNzcwNTIwIDIxMDQ4OTY2Njg3NDc5OA==