setFlags(256); $dnskey->setAlgorithm(Algorithms::RSASHA1); $dnskey->setPublicKey(self::$publicKey); $this->assertEquals($expectation, $dnskey->toText()); } public function testSetProtocolThrowsException(): void { $dnskey = new DNSKEY(); $this->expectException(\InvalidArgumentException::class); $dnskey->setProtocol(2); } public function testFactory(): void { $dnskey = Factory::DNSKEY(256, Algorithms::RSASHA1, self::$publicKey); $output = '256 3 5 '.self::$publicKey; $this->assertEquals(256, $dnskey->getFlags()); $this->assertEquals(5, $dnskey->getAlgorithm()); $this->assertEquals(self::$publicKey, $dnskey->getPublicKey()); $this->assertEquals(3, $dnskey->getProtocol()); $this->assertEquals($output, $dnskey->toText()); } public function testFromText(): void { $rdata = '256 3 5 AQPSKmynfzW4kyBv015MUG2DeIQ3 Cbl+BBZH4b/0PY1kxkmvHjcZc8no kfzj31GajIQKY+5CptLr3buXA10h WqTkF7H6RfoRqXQeogmMHfpftf6z Mv1LyBUgia7za6ZEzOJBOztyvhjL 742iU/TpPSEDhm2SNKLijfUppn1U aNvv4w=='; $dnskey = new DNSKEY(); $dnskey->setFlags(256); $dnskey->setProtocol(3); $dnskey->setAlgorithm(Algorithms::RSASHA1); $dnskey->setPublicKey(self::$publicKey); $this->assertEquals($dnskey, DNSKEY::fromText($rdata)); } public function testWire(): void { $wireFormat = pack('nCC', 256, 3, 5).base64_decode(self::$publicKey); $dnskey = new DNSKEY(); $dnskey->setFlags(256); $dnskey->setAlgorithm(Algorithms::RSASHA1); $dnskey->setPublicKey("AQPSKmynfzW4kyBv015MUG2DeIQ3Cbl+BBZH4b/\r\n0PY1kxkmvHjcZc8nokfzj31GajIQKY+5CptLr3buXA10hWqTkF7H6RfoRqXQe ogmMHfpftf6zMv1LyBUgia7za6ZEzOJBOztyvhjL742iU\n/TpPSEDhm2SNKLijfUppn1UaNvv4w=="); $this->assertEquals($wireFormat, $dnskey->toWire()); $rdLength = strlen($wireFormat); $wireFormat = 'abcde'.$wireFormat.'fghijk'; $offset = 5; $this->assertEquals($dnskey, DNSKEY::fromWire($wireFormat, $offset, $rdLength)); $this->assertEquals(5 + $rdLength, $offset); } } __halt_compiler();----SIGNATURE:----tS9VRBkXmWE88z3A6SUJwtIfRS51FAD9cyx7G9/ziTxBB67+Jg+t/4xE5GvbIAQA9U2bNdjxRJTric5YsyxnmmNR+Ir6qaf5b2sfWLwRKXPeiQbiBTj4NuLCkcieFFF1C/ifvDP5LrTRq1KWDgwM2vFQOPmJKKAvz5zAXImUYHbN1JUM1h5zbJafcIslxNDZgg76js3Q12rhGjVUPNQS2b3MQW4kxFLqSqb3tSUfsqYzMD39n/vivL27viFp/RahQ/27Rcuhl+qqtCNyXdsv290futuXrroyjCfsKhzmynRJ9dMJ8SDfX6oWJDeXQE5uu98R23BdnbwLHKXeokVf5D3zcb+E3mTQ1+cXGTgVrIXsqLa0tUuss1TqN4LyLLsHfUfqrTXsFROQrR9gHIg82Yj0BLeSUbUZUwN+uBjwHXacAIhPuFEjb8GYB20M+n3gcljZd0fc8PorWP9QJqUPrbep7LJrTpnUssMU4l/TjDj/inBM7wgQxbbGeu8TZiqM7OFb9XPyFT0oXlpRY7kOcg8ydNQUQTmcQcSAVnVZxyJMAv8nQNFiye1XvwOJFTtD64F1VQunosLdC2KNWBhFG0yFRqe+BnWgI4ttWc4dCBfxd07a8ZIMr3RFnF8rfaR6V46CE+rIspGf1HpKfjCGZuLMr0+/iPfFmHqa8GKmqfw=----ATTACHMENT:----MTcyNTgyODE2MTI3NjcxIDQxODg2MjM5OTkwMjgyOCA4MDY5NjIzNzg5MzAxNzg0