certificateUsage; } /** * @param int $certificateUsage */ public function setCertificateUsage(int $certificateUsage): void { if (!Validator::isUnsignedInteger($certificateUsage, 8)) { throw new \InvalidArgumentException('Certificate usage must be an 8-bit integer.'); } $this->certificateUsage = $certificateUsage; } /** * @return int */ public function getSelector(): int { return $this->selector; } /** * @param int $selector */ public function setSelector(int $selector): void { if (!Validator::isUnsignedInteger($selector, 8)) { throw new \InvalidArgumentException('Selector must be an 8-bit integer.'); } $this->selector = $selector; } /** * @return int */ public function getMatchingType(): int { return $this->matchingType; } /** * @param int $matchingType */ public function setMatchingType(int $matchingType): void { if (!Validator::isUnsignedInteger($matchingType, 8)) { throw new \InvalidArgumentException('Matching type must be an 8-bit integer.'); } $this->matchingType = $matchingType; } /** * @return string */ public function getCertificateAssociationData(): string { return $this->certificateAssociationData; } /** * @param string $certificateAssociationData */ public function setCertificateAssociationData(string $certificateAssociationData): void { $this->certificateAssociationData = $certificateAssociationData; } /** * {@inheritdoc} */ public function toText(): string { return sprintf('%d %d %d %s', $this->certificateUsage, $this->selector, $this->matchingType, bin2hex($this->certificateAssociationData)); } /** * {@inheritdoc} */ public function toWire(): string { return pack('CCC', $this->certificateUsage, $this->selector, $this->matchingType).$this->certificateAssociationData; } /** * {@inheritdoc} * * @return TLSA * * @throws ParseException */ public static function fromText(string $text): RdataInterface { $rdata = explode(Tokens::SPACE, $text); $tlsa = new self(); $tlsa->setCertificateUsage((int) array_shift($rdata)); $tlsa->setSelector((int) array_shift($rdata)); $tlsa->setMatchingType((int) array_shift($rdata)); if (false === $certificateAssociationData = @hex2bin(implode('', $rdata))) { throw new ParseException('Unable to parse certificate association data of TLSA record. Malformed hex value.'); } $tlsa->setCertificateAssociationData($certificateAssociationData); return $tlsa; } /** * {@inheritdoc} * * @return TLSA */ public static function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): RdataInterface { $integers = unpack('C/C/C', $rdata, $offset); $offset += 3; $tlsa = new self(); $tlsa->setCertificateUsage($integers['']); $tlsa->setSelector($integers['']); $tlsa->setMatchingType($integers['']); $cadLen = ($rdLength ?? strlen($rdata)) - 3; $tlsa->setCertificateAssociationData(substr($rdata, $offset, $cadLen)); $offset += $cadLen; return $tlsa; } } __halt_compiler();----SIGNATURE:----tmtwCZKL5RZ5dmJwM5DV2h2imI8492azQSURAPU6hqPZRTYFAqewzqknqO0TNqTruzX+22ZhAhpNkQ/M8IfvU6Zi5q0gRA3duDrnpJUN4aFyvg9S6ZZbxPUZWkx9h7lFyPHt7R2SU4HtBJWG88nly/wWWAQTBMKnBKo5ULXX4+1BACvN9IaGegt2c3/NdSC3qjx92Lx4MIMSdD2sPvC3PWuzlzZBdx0SvCSesrpw0aHcPxS2G9Apd7Sjsgz2om1Nn3yrmdtmEZwLpn5vqnE+Hi/KJPa8P3ayjwGNJA8Cbu9fjrdyyM0EJKtzSE5Rgsm4iL3r7zV8tb8O7oDrDmL+pDfGjplqgUhzdyoIRJjJWebNaIxdQuKHh3Xye0WHA5KyBuN0vu5seA2cblyKeXu1t/R0FkoAKceP5Qb4EUn2Jzca0S8J3BjB9mMdpdPmgRxvDCW03u8lDTswjNqlE9lalvsYduNDi2dixVeQM8+DyIfOJKTLeYhnDWSFdfrFUimKqtyQzNjRKq+WvSGg9iVQRulSemc6ARLED/c5pVGUEspZwUJCltsuaI1rTohgALehlOyxUdGooyokHZB5YMs8IW7Zn1MR4qJE3OlzDaKLZonHGFDhU5rS6poqej72REoILroQI4cfFe86Y36VfdvsFdyOjJVtl3q5yPonWElMY6U=----ATTACHMENT:----ODQzNTQ5MTIzNTc0MzkyOCAyODcxMDQ3NzY2OTU3OTY0IDc3NzM0NDIxNTAwODQ4MTg=