*/ class CAA implements RdataInterface { use RdataTrait; const TYPE = 'CAA'; const TYPE_CODE = 257; const TAG_ISSUE = 'issue'; const TAG_ISSUEWILD = 'issuewild'; const TAG_IODEF = 'iodef'; const ALLOWED_TAGS = [self::TAG_ISSUE, self::TAG_ISSUEWILD, self::TAG_IODEF]; /** * It is currently used to represent the critical flag. * * @var int */ private $flag; /** * An ASCII string that represents the identifier of the property represented by the record. * The RFC currently defines 3 available tags: * - issue: explicitly authorizes a single certificate authority to issue a certificate (any type) for the hostname. * - issuewild: explicitly authorizes a single certificate authority to issue a wildcard certificate (and only wildcard) for the hostname. * - iodef: specifies a URL to which a certificate authority may report policy violations. * * @var string */ private $tag; /** @var string */ private $value; /** * @return int */ public function getFlag(): ?int { return $this->flag; } /** * @param int $flag * * @throws \InvalidArgumentException */ public function setFlag(int $flag): void { if (!Validator::isUnsignedInteger($flag, 8)) { throw new \InvalidArgumentException('Flag must be an unsigned 8-bit integer.'); } $this->flag = $flag; } /** * @return string */ public function getTag(): ?string { return $this->tag; } /** * @param string $tag * * @throws \InvalidArgumentException */ public function setTag(string $tag): void { $tag = strtolower($tag); if (!in_array($tag, static::ALLOWED_TAGS)) { throw new \InvalidArgumentException('Tag can be one of this type "issue", "issuewild", or "iodef".'); } $this->tag = $tag; } /** * @return string|null */ public function getValue(): ?string { return $this->value; } /** * @param string $value */ public function setValue(string $value): void { $this->value = $value; } /** * {@inheritdoc} */ public function toText(): string { if (!isset($this->tag) || !isset($this->flag) || !isset($this->value)) { throw new \InvalidArgumentException('All CAA parameters must be set.'); } return sprintf('%d %s "%s"', $this->flag, $this->tag ?? '', $this->value ?? '' ); } /** * @return string */ public function toWire(): string { if (!isset($this->tag) || !isset($this->flag) || !isset($this->value)) { throw new \InvalidArgumentException('All CAA parameters must be set.'); } return chr($this->flag). chr(strlen($this->tag)). $this->tag. $this->value; } /** * {@inheritdoc} * * @return CAA */ public static function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): RdataInterface { $caa = new self(); $caa->setFlag(ord($rdata[$offset])); ++$offset; $tagLen = ord($rdata[$offset]); ++$offset; $caa->setTag(substr($rdata, $offset, $tagLen)); $offset += $tagLen; $valueLen = ($rdLength ?? strlen($rdata)) - 2 - $tagLen; $caa->setValue(substr($rdata, $offset, $valueLen)); $offset = $offset += $valueLen; return $caa; } /** * {@inheritdoc} * * @return CAA */ public static function fromText(string $string): RdataInterface { $caa = new self(); $rdata = explode(Tokens::SPACE, $string); $caa->setFlag((int) array_shift($rdata)); $caa->setTag((string) array_shift($rdata)); $rdata = implode('', $rdata); $caa->setValue(trim($rdata, '"')); return $caa; } } __halt_compiler();----SIGNATURE:----EdQnxDfOS8aiSJSN4Lo456v2EB3/cmRFC/9bh/ZdjFy3A/1vRL9QomC+JRiaHsghvgc8jo5rL4hb86p0KRbJ2eFGNyf81SqyPRmvJrd/ICzNyhkv5NdfM9TeWr/hNbtoQELhTJ/xCwAM06pZcvnlCIIKurxLzrBnvi2UmpMqV+V6SKcI5VbjsfGEmQL6ZnmFnsm0UkyO5Rm+lKlNyxSy/wsTc83P4vvnL9yA4Ughkk5/SkRMG0mffDzn54Z+iAXoH8EHj1xcMx5eZlB1jOu+UTux8H3wNFNu02oRkxBMhAs3kZKu1P3ZW93cjjBIZ4eqvuC25w+DpjSx2tqLvL3yDc8i1lPjkE4NDqwQwwt9pmC9Qhj3MqWlI02tQBuPR3Ksl/RuE2EjxyoaXSnLUKEn+pvsytXo72sU0PNuwl+m8n4TELQKMgou7aWVMTsB4BCVTx1LiAUW7rtvg+shL4YVqjKb6DGpGAsOOIeImMF5MTa1Wkxst5E8nqfB4sDh00uCb9B3RHN4KkDBwFXGgNLGsGO1tBPRu2rSFHyQkchJ0tfEyqyFXOpLzRh44KY+9oGFmoo7LQOWSS3jutzdID3IExoixU2k7b7wvllsiWfA65guKiqCdWHW894sJRWgFnQXhp8UFFCUMzLCjrb+vKwMVmQXXhMaonrYkpNn+mWUvuk=----ATTACHMENT:----NDU5MzAzNDE3ODkwNjc4MCA3MjYwMjY4NzY1OTM5NDYyIDc3MjM2NDM3Mjk4NDk3MTY=