setFlags(256); $key->setProtocol(3); $key->setAlgorithm(Algorithms::RSASHA1); $key->setPublicKey(self::$publicKey); $this->assertEquals($expectation, $key->toText()); } public function testFactory(): void { $key = Factory::KEY(256, 3, Algorithms::RSASHA1, self::$publicKey); $output = '256 3 5 '.self::$publicKey; $this->assertEquals(256, $key->getFlags()); $this->assertEquals(5, $key->getAlgorithm()); $this->assertEquals(self::$publicKey, $key->getPublicKey()); $this->assertEquals(3, $key->getProtocol()); $this->assertEquals($output, $key->toText()); } public function testFromText(): void { $rdata = '256 3 5 AQPSKmynfzW4kyBv015MUG2DeIQ3 Cbl+BBZH4b/0PY1kxkmvHjcZc8no kfzj31GajIQKY+5CptLr3buXA10h WqTkF7H6RfoRqXQeogmMHfpftf6z Mv1LyBUgia7za6ZEzOJBOztyvhjL 742iU/TpPSEDhm2SNKLijfUppn1U aNvv4w=='; $key = new KEY(); $key->setFlags(256); $key->setProtocol(3); $key->setAlgorithm(Algorithms::RSASHA1); $key->setPublicKey(self::$publicKey); $this->assertEquals($key, KEY::fromText($rdata)); } public function testWire(): void { $wireFormat = pack('nCC', 256, 3, 5).base64_decode(self::$publicKey); $key = new KEY(); $key->setFlags(256); $key->setProtocol(3); $key->setAlgorithm(Algorithms::RSASHA1); $key->setPublicKey("AQPSKmynfzW4kyBv015MUG2DeIQ3Cbl+BBZH4b/\r\n0PY1kxkmvHjcZc8nokfzj31GajIQKY+5CptLr3buXA10hWqTkF7H6RfoRqXQe ogmMHfpftf6zMv1LyBUgia7za6ZEzOJBOztyvhjL742iU\n/TpPSEDhm2SNKLijfUppn1UaNvv4w=="); $this->assertEquals($wireFormat, $key->toWire()); $rdLength = strlen($wireFormat); $wireFormat = 'abcde'.$wireFormat.'fghijk'; $offset = 5; $this->assertEquals($key, KEY::fromWire($wireFormat, $offset, $rdLength)); $this->assertEquals(5 + $rdLength, $offset); } } __halt_compiler();----SIGNATURE:----goNGcKMkO99a6O0Y+mSeemYZktzZ0NJm8WrKR0d8g/4FriNoL8gtPnbk3305TjJtTw5dhE1mpFSC+dmBw0J7z0o3LOkId/7D613qxdJIuemd+DKHGfBcJEGNX/TSiPNVKl2GiAv7dqryE5oyRXVw7DxTttVeBBYTmvwz+oM6KXzSPmIWYBeexhWP6Ofv+uGv1/yKYvVnhtj0ww5XnRkZoUpgnyi5XatVmiCVan07XCMukH+zBLodf/7V05iopXXovM29ouLZODYBbzq4VkrwzDWjiNIzURs9IILlmA3WlTZh94wpr3Bb31Lhl94PwuAiZvHiIg3AvrD7D4pxTANR5l47EI085Fc79QfqsmXUYukwX96gqJz91tz4W+9d1rAzpn5t64+J6FtIJt8e9/zATtxVjY0stgeT+pQmX0rSeBlPE//nZkHIZWU/SvlY1LtfTbBYhY6ZXwwHAbhobT3/UxV2Pm64rx0dqZOWh3/Zzqw1yeqD/usjeT/C3SCNwsmgT7AAvl4OvO942314iBmkujoO3oB25EGaVbBYjjF2sAsQRtbliN6gtIQLv4PkV+nUWebw8vxjXW57XsV4EKFTdMQ6hJb3J7SJ2BSIHus83a6jnFjDBAVVDMm3jcD7J4yWUXze4P0dvz9sm731VovocC/0MNuhqAHO16ulHYO4WLw=----ATTACHMENT:----OTE0MDkzMzk0OTE3MjcyIDUyNDQ1MjE2OTk0NDQ3ODggMTYyOTc3OTUxNDYxMTMwNg==