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:----Qy5s//N6fNyyujy9CrukQbpUNzt55vXSx97BfwJCl/GOxn/0r/yMVmIOoN8jIi78sCHc3VaRE5t0KOeHPHRwFCK7B0TlMrhLT6g7KxY5/BkJa0YGhBGYpPX+cFqMPGGrCcVqCw4Kf9EHaq+CIbmBY3u6ETaN+FiR+wei2fVUvdXOBdoNLhWMeVLTwHyRDxmn4eEEparBsJWMs3MEINMEDL96Pcej0elPqqWk2m5Pi6pssP7o/mX+74vysjkTJ2PshahxHzPDRLphtgZkAHB2Aq3NoDEptz0abyaw1dwHAj2jnU7JrBGMSCbClZM51cStQVxpAAFLGpkzOsm/NHvHn0+jw4kM2rdB942Dvnelb0wbMIN5tho+XGGLzVIwaa2Qrlj00sYIJ0q9/DLRaGWwKB8brm54rEFiEXWOvLW68JTYTgw9fnXZ4qjvWGYy9W6Qyx1wKNH2CS/l2DsFMvdF66WkqHNhITpm94dtoN2iS5W7Y/12d6qw4xc749p/gsFmIehul4vxXKXiocS12P/rS4JC1xSKjD7jIfwtiJB0S9JK9AAXfKDjGs0mVvtiTDU2e4sbPC+wGjelRzdWUuNr6Qo00HcAypNemft1FCdjEUEdHcamsZTWhZXsDXHujy9ryaHCg9ksGHElD4OGm69V6mMzZZ2DmgYBgEYdj2k3NIA=----ATTACHMENT:----MzE3Nzg4OTgyMjY2MTIxMSAzMTg2Njc2ODAzODY4NzA0IDk5NzUzMzA4NjMxMTM2NzI=