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:----RPM6YOOq3mLgqwbMZTgH7rl3v0f2Temh6NcRarXsDP9Oxp3sRJlMlmYuSYr9oOl7nQudo9KqTr6IfnlnN1IuYdf8BP1eeyKppmnA9aaWpT9Khwr3wyGU518LROyuli0uMpx3pSqVLfn52zOyTmlZqEXyMjsbpTXCaXKqZGcLHapBiZ8kU/XSQnt/K0sficg1gXripbpDrZu25BxHTcwWgeIGabq62w1AvkCVDa1iHe+eMCMYsZQ5hvgyg74zePVaPTddNPDoGluII2MZLiv82Niq9CJ5aS0gwRaL3hF4J9jQXCaJqnmUKt6Ze0bm2GlMBeg+MYav7Y5ec/5jP6eQCG/fUsf3e5+5ApWXQD1IlXK8C1qy7oD3E97r140DQDU5xZIGh9kqxopCwNOTFkOIOh4YYrttyKM9BZlv5/F7fT4Fr1lDS2+CREkI6ZjYNmwggzDsz9pPCiQCWyOA5hH0VBeXZMgt82v6Jii5wb97juhHluFsi04WlMLJBmeMoHf9uNRAomcL1JtbmYN+lztKawbbsRE39ZYqJGrPtZrI8UPgxVB1/STGWOE94KEZxfB4W0RQJvHyB81OTecAtQj5S0DYutRa2cAP/bohvUK1ZvaY4+TDnDMbFRIh8ERRrGfx4JfSWblo60TEed0E6lO0R+QtpqH9M3a5NR08nxYr6lU=----ATTACHMENT:----OTU1NjI4Njc3NDE0MjU4NSA2ODc2NTI4OTE2NjEyNjQyIDI1OTI0ODc0OTk4MTA4MjI=