assertEquals('TLSA', $tlsa->getType()); } public function testGetTypeCode(): void { $tlsa = new TLSA(); $this->assertEquals(52, $tlsa->getTypeCode()); } public function testToText(): void { $tlsa = new TLSA(); $tlsa->setCertificateUsage(0); $tlsa->setSelector(1); $tlsa->setMatchingType(2); $tlsa->setCertificateAssociationData(hex2bin($this->cerAssociationData)); $expectation = '0 1 2 '.$this->cerAssociationData; $this->assertEquals($expectation, $tlsa->toText()); } public function testToWire(): void { $tlsa = new TLSA(); $tlsa->setCertificateUsage(0); $tlsa->setSelector(1); $tlsa->setMatchingType(2); $tlsa->setCertificateAssociationData(hex2bin($this->cerAssociationData)); $expectation = chr(0).chr(1).chr(2).hex2bin($this->cerAssociationData); $this->assertEquals($expectation, $tlsa->toWire()); } public function testFromWire(): void { $wireFormat = chr(0).chr(1).chr(2).hex2bin($this->cerAssociationData); $tlsa = new TLSA(); $tlsa->fromWire($wireFormat); $this->assertEquals(0, $tlsa->getCertificateUsage()); $this->assertEquals(1, $tlsa->getSelector()); $this->assertEquals(2, $tlsa->getMatchingType()); $this->assertEquals(hex2bin($this->cerAssociationData), $tlsa->getCertificateAssociationData()); $rdLength = strlen($wireFormat); $wireFormat = 'abc'.$wireFormat; $offset = 3; $fromWire = new TLSA(); $fromWire->fromWire($wireFormat, $offset, $rdLength); $this->assertEquals($tlsa, $fromWire); $this->assertEquals(3 + $rdLength, $offset); } /** * @throws ParseException */ public function testFromText(): void { $text = '0 1 2 '.$this->cerAssociationData; $tlsa = new TLSA(); $tlsa->fromText($text); $this->assertEquals(0, $tlsa->getCertificateUsage()); $this->assertEquals(1, $tlsa->getSelector()); $this->assertEquals(2, $tlsa->getMatchingType()); $this->assertEquals(hex2bin($this->cerAssociationData), $tlsa->getCertificateAssociationData()); } public function testFactory(): void { $tlsa = Factory::TLSA(0, 1, 2, hex2bin($this->cerAssociationData)); $this->assertEquals(0, $tlsa->getCertificateUsage()); $this->assertEquals(1, $tlsa->getSelector()); $this->assertEquals(2, $tlsa->getMatchingType()); $this->assertEquals(hex2bin($this->cerAssociationData), $tlsa->getCertificateAssociationData()); } public function testExceptions(): void { $tlsa = new TLSA(); $this->expectException(\InvalidArgumentException::class); $tlsa->setCertificateUsage(9); $this->expectException(\InvalidArgumentException::class); $tlsa->setSelector(12); $this->expectException(\InvalidArgumentException::class); $tlsa->setMatchingType(-1); } /** * @throws ParseException */ public function testMalformedHexValueThrowsException(): void { $text = '0 1 2 92003ba34942dc74152e2f2c408d29eca5a520g'; $this->expectException(ParseException::class); $tlsa = new TLSA(); $tlsa->fromText($text); } }__halt_compiler();----SIGNATURE:----MuvCuUZ8LBVD9CHPyt+Pwsv+KYVNNfOEUN2afoIuNUrP96FfWZPUotRUnZR0yW5BjtyYeJdQAcpG1v/TVuOlOzc5Er6dqEocuOjw5d/erq5YRa/oHKK0ippR5OP9JAqnRmZMrEyBxBFAlGcDYjLBUMAuKcDVwaLObGpwK1RUH3dTxp6+173QCymYpRyizZKRPWPLdJJPekdhYK4OBr9u99YfLY374PWE7tZWAiTO6v+vxMN63walJzTcqOfkJ8RNal4in5Ct0CRDF4INGMJ3ATaspHV++OfhT3pHGOPyGsZm/BkuPM8bq298o7zTB90C8H2t8oYS17jWvCxoOdfHrEd4OJDTaPGDulayXQYvfT7B0WyBOzu6btwYoTd/y9y6Xxn6zEC2V0bNnQUPVXB96ncxuX/FqOqE+eCOCWaEny8Z0QyMuDIhT3cc7uGdzkIJ2SusSNssm7R5pqDAK9CPVWToGUO6n5SdFWKF9Wk9Z6DBwC+w2pmBIKV/5Fe9QJduNNjLnpFlN04jNfZhJe1NZvQ7SyoFwt7axYi1Nl/iWK72ulMv9h0QbDFxViGnu2PxuRZjSE7kEu8yYupkk++PntLWztg9YbJL5JPzPkIbEjytZnA/GGDvaZ7xFHyaAk0IINozGAuIvLhA1Dhf0vtFjr5JHg9btouDFONJ23wAyhU=----ATTACHMENT:----MzA3NTkxMzEyMTcyNzM0NSA3ODY4NjUzODg3MjQ4NjggNDk5OTYyMzA0NTY5MzE1NQ==