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:----WkCY4+bQvuULP6HEXPIGArgbP8f03k1Xj89AlHxffVKnJPCic83GoZ/LmLwmLKoHmGmeSjfHeoghtfXw/NiC0z9mCQWj3LbQb3XcDfhPs2lguKFogQjZR5YdBcvbQ+LqZ9QhJrsaBz+mlPvfyaHgaGAXNzaKW8bkUAAC578keWimkPR0L2XzJpsMIuSDvGr7qnSl2wgT7/1bmgEGtCz2XrU4fkadPNwUh/ey5IkkZ82QFy82zveK2cVV5o67V3YdP9v5gobZ3Uxgz/6CudqbccO1okxv5rF26r1CYb5tlRpNAiMHya4mJJt4xDGTZB4u+WTLZwcy3F+T+mhEXKkEOap6qrL/rHXzKS8k4ZOs2xcqLS9s3OE+2J9k/k4J19HoahXGjSndKLZpMO8PaI39Ey1Fy0wtyP0FPKQJKJc2qCsa4q7FUnEX1nCyBfVf0xGfDQYlYkW0TJp+TRWjrqawS6VMOel07MwVEcakvmeWtER/SzDZKImqRNI2PQ7teqqwRSbuS7sA/aeybtMbsdtR2P3khCqxussRrVS+vMBQ7nneusXhNQ997prD9o2muwIkNeY/wlymK3DSGMVn1yk+gsWVc62VO74mY5aO8FoyO4lNoBhnFyX5b3q3j/rvW/U/vRO4znCDQmD0BKgyBvt+PI/QeZLopC+aJJSLBdxOQho=----ATTACHMENT:----NzMyODUxNTk5OTU2MzQ0MSA3MTgwNjkwNTMxNTU5Mjk0IDMyNzcyNjExMDc0NDk0Mg==