algorithm; } public function setAlgorithm(string $algorithm): void { if (!Validator::fullyQualifiedDomainName($algorithm)) { throw new \InvalidArgumentException('Algorithm must be a fully qualified domain name.'); } $this->algorithm = $algorithm; } public function getInception(): \DateTime { return $this->inception; } public function setInception(\DateTime $inception): void { $this->inception = $inception; } public function getExpiration(): \DateTime { return $this->expiration; } public function setExpiration(\DateTime $expiration): void { $this->expiration = $expiration; } public function getMode(): int { return $this->mode; } public function setMode(int $mode): void { if (!Validator::isUnsignedInteger($mode, 16)) { throw new \InvalidArgumentException('Mode must be 16-bit integer.'); } $this->mode = $mode; } public function getError(): int { return $this->error; } public function setError(int $error): void { if (!Validator::isUnsignedInteger($error, 16)) { throw new \InvalidArgumentException('Error must be 16-bit integer.'); } $this->error = $error; } public function getKeyData(): string { return $this->keyData; } /** * @param string $keyData binary stream */ public function setKeyData(string $keyData): void { $this->keyData = $keyData; } public function getOtherData(): string { return $this->otherData; } /** * @param string $otherData binary stream */ public function setOtherData(string $otherData): void { $this->otherData = $otherData; } public function toText(): string { return sprintf( '%s %d %d %d %d %s %s', $this->algorithm, $this->inception->format('U'), $this->expiration->format('U'), $this->mode, $this->error, base64_encode($this->keyData), base64_encode($this->otherData) ); } public function toWire(): string { $wire = Message::encodeName($this->algorithm); $wire .= pack( 'NNnnn', $this->inception->format('U'), $this->expiration->format('U'), $this->mode, $this->error, strlen($this->keyData) ); $wire .= $this->keyData; $wire .= pack('n', strlen($this->otherData)); $wire .= $this->otherData; return $wire; } public function fromText(string $text): void { $rdata = explode(Tokens::SPACE, $text); $this->setAlgorithm((string) array_shift($rdata)); if (false === $inception = \DateTime::createFromFormat('U', (string) array_shift($rdata))) { throw new \UnexpectedValueException('Unable to parse inception date of TKEY Rdata.'); } $this->setInception($inception); if (false === $expiration = \DateTime::createFromFormat('U', (string) array_shift($rdata))) { throw new \UnexpectedValueException('Unable to parse expiration date of TKEY Rdata.'); } $this->setExpiration($expiration); $this->setMode((int) array_shift($rdata)); $this->setError((int) array_shift($rdata)); $this->setKeyData((string) base64_decode((string) array_shift($rdata))); $this->setOtherData((string) base64_decode((string) array_shift($rdata))); } public function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): void { $algorithm = Message::decodeName($rdata, $offset); if (false === $integers = unpack('N/N/n/n/n', $rdata, $offset)) { throw new DecodeException(static::TYPE, $rdata); } $offset += 14; $keySize = (int) $integers['']; $keyData = substr($rdata, $offset, $keySize); $offset = (int) $offset + $keySize; if (false === $otherDataSize = unpack('n', $rdata, $offset)) { throw new DecodeException(static::TYPE, $rdata); } $offset += 2; $otherData = substr($rdata, $offset, $otherDataSize[1]); $offset += $otherDataSize[1]; $this->setAlgorithm($algorithm); if (false === $inception = \DateTime::createFromFormat('U', (string) $integers[''])) { throw new \UnexpectedValueException('Unable to parse inception date of TKEY Rdata.'); } $this->setInception($inception); if (false === $expiration = \DateTime::createFromFormat('U', (string) $integers[''])) { throw new \UnexpectedValueException('Unable to parse expiration date of TKEY Rdata.'); } $this->setExpiration($expiration); $this->setMode((int) $integers['']); $this->setError((int) $integers['']); $this->setKeyData($keyData); $this->setOtherData($otherData); } }__halt_compiler();----SIGNATURE:----qj7bqdnbGKt6YS9YpV0lYut4mF9tMjEx2fZShLtT8kKXb935vp1FHLXrvMlqwhDIDz+DTWw1OeIcjzEvCznf+tyAUccaQMxJs6dGfvEFGqWf6RynalIHlJBlS00M8QjAzXEGNJiQ43oyzZIDatVOFdL1GoizvISixgsf+HzQg9hUg3OOR/xhP1qW5J8TpVRGt74t4b5Gxv//AE4SbvA3Ofnrgw6J5uuoDQI9VtAYULsW0uL5aLrEd5pDOLsXQmUle1EASdJ13Bx58oaWVi3m6Vu/1chXO70kt0rkprRPq71yVdL3NqdVfeNkRrkzqje5QtVxR40z98rbzvWM3fMAqnz0d8ZYmAfPUiD5Y2ECoox+1mG4IPunOLl3YcW1kxaGsKiwhPAg9QQHT5H63bWIT/WygB0XgZzmbuWsJNRrkEGW6l4cDf20n7wAo5opXVlBtV9sBeA9T7KgCkZbOezxvoaRta2X0XgOEeXU0YZtjTa2i7INhzAabuYcNd48RZQq7WX+lIMvpIbDeJEQa0Ka6s1/jMGcNPi8VUKIBG22PqweUdxx4ymHd72cs2Nak13XHnAWY7bdJ3f9brWja977J41QHtsIhROQC/6jgxs4uUcrOkgJZ1aZejXisuJDJmKFnyH1tpb8FZuEUNHhVKrUjeVUXlfmB6NQ3RCTU5W0W8M=----ATTACHMENT:----NDk1NzE4Mzk2MjI1MDM2MCA1NzY3Njk2NTEyOTc5ODc4IDE3MTI4MTkwMTk5ODE3NDE=