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; } public function getTimeSigned(): \DateTime { return $this->timeSigned; } public function setTimeSigned(\DateTime $timeSigned): void { $this->timeSigned = $timeSigned; } public function getFudge(): int { return $this->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; } public function getMac(): string { return $this->mac; } public function setMac(string $mac): void { $this->mac = $mac; } public function getOriginalId(): int { return $this->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; } public function getError(): int { return $this->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; } public function getOtherData(): string { return $this->otherData; } public function setOtherData(string $otherData): void { $this->otherData = $otherData; } 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) ); } public function toWire(): string { $timeSigned = (int) $this->timeSigned->format('U'); $hex1 = (0xFFFF00000000 & $timeSigned) >> 32; $hex2 = (0x0000FFFF0000 & $timeSigned) >> 16; $hex3 = 0x00000000FFFF & $timeSigned; $wire = Message::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; } /** * @throws ParseException */ public function fromText(string $text): void { $rdata = explode(Tokens::SPACE, $text); $this->setAlgorithmName((string) array_shift($rdata)); if (false === $timeSigned = \DateTime::createFromFormat('U', (string) array_shift($rdata))) { throw new ParseException('Unable to decode TSIG time signed.'); } $this->setTimeSigned($timeSigned); $this->setFudge((int) array_shift($rdata)); if (false === $mac = base64_decode((string) array_shift($rdata), true)) { throw new ParseException('Unable to decode TSIG MAC. Malformed base64 string.'); } $this->setMac($mac); $this->setOriginalId((int) array_shift($rdata)); $this->setError((int) array_shift($rdata)); if (false === $otherData = base64_decode((string) array_shift($rdata), true)) { throw new ParseException('Unable to decode TSIG other data. Malformed base64 string.'); } $this->setOtherData($otherData); } /** * @throws DecodeException */ public function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): void { $this->setAlgorithmName(Message::decodeName($rdata, $offset)); if (false === $args = unpack('n/n/n/n/n', $rdata, $offset)) { throw new DecodeException(static::TYPE, $rdata); } $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['']; $this->setFudge($args['']); $this->setTimeSigned($objTimeSigned); $this->setMac(substr($rdata, $offset, $macLen)); $offset += $macLen; if (false === $args = unpack('n/n/n', $rdata, (int) $offset)) { throw new DecodeException(static::TYPE, $rdata); } $offset += 6; $otherLen = (int) $args['']; $this->setOriginalId($args['']); $this->setError($args['']); $this->setOtherData(substr($rdata, (int) $offset, $otherLen)); $offset += $otherLen; } }__halt_compiler();----SIGNATURE:----eAxR8hOmDx7fFMJkEdbBdonK77V8GTyWaYWtdATZ2gCvp1YyGzppvUj3vDGK9LtVtUjHY4Lp1/yLxYQBF/aQIdyBL2Rp7YZU8PDIHGsgxbVjtEzt9hFhPXkL8hjItK4d4X0uRmxy9emTTpseyngc8+maTlvE6N+9mGBwo9oc/GQFN1r/WlYnNT1bpIy9Wqy3/6cdY7/icnbZ9USY0K+fT/QVyWNT+xR7xfQlu84gBInQ/g8gAOgC1eJmtlJw6ZGnLsfHn2sytOr2H3KPAgkn61EfMyCArN4r8UtvPTwBYyOo0TeYuDPWMtL3CBvS79ugcf2eie+K/1U7WAyj5vLs3IT9Yi/uoH3jVf7V1E20HIuWqFuH5ah3HYP8cQx+uQfopmsnTzmYik5g/DrNXQ12UJu//VrKVizEIfECEq1ROqxymSO0dDBi2HqIPqqxHMJy0wiexrgv2mK/MyT2InlQAROPOm6dleZAAWhwoDy4u1nttZp2y8VInbK0ZxdOQyR6NktafeYxWENaxALiUzbbfT2mXiiJz8QAoiapxSgWqNKLgg35Em63OAJAd7GMqNnYkfh9VCbFRyvz3T1azZTAk5PzzyS1BIy9eNKUhNdy8mAvPnfiXryLaJANKFM6TPRGYsU7WugbyBdFzPxergWgRnt+XOn09IsJs4iAyWZdC+8=----ATTACHMENT:----Njg2Mjg5NDMwNTk3MDk5MyA3NjE1NDIyMzUwODQyNzEzIDkwNTY0MTA0MjQ1Mjc2NjY=