markTestSkipped('RRSIG test does not work on 32-bit systems.'); } $expectation = 'A 5 3 86400 20050322173103 20030220173103 2642 example.com. '.self::$signature; $rrsig = new RRSIG(); $rrsig->setTypeCovered('A'); $rrsig->setAlgorithm(Algorithms::RSASHA1); $rrsig->setLabels(3); $rrsig->setOriginalTtl(86400); $rrsig->setSignatureExpiration(\DateTime::createFromFormat(RRSIG::TIME_FORMAT, '20050322173103')); $rrsig->setSignatureInception(\DateTime::createFromFormat(RRSIG::TIME_FORMAT, '20030220173103')); $rrsig->setKeyTag(2642); $rrsig->setSignersName('example.com.'); $rrsig->setSignature(self::$signature); $this->assertEquals($expectation, $rrsig->toText()); } public function testFactory(): void { $rrsig = Factory::RRSIG( A::TYPE, Algorithms::RSASHA1, 3, 86400, \DateTime::createFromFormat('Ymd', '20220101'), \DateTime::createFromFormat('Ymd', '20180101'), 2642, 'example.com.', self::$signature ); $this->assertEquals(A::TYPE, $rrsig->getTypeCovered()); $this->assertEquals(Algorithms::RSASHA1, $rrsig->getAlgorithm()); $this->assertEquals(3, $rrsig->getLabels()); $this->assertEquals(86400, $rrsig->getOriginalTtl()); $this->assertEquals(\DateTime::createFromFormat('Ymd', '20220101'), $rrsig->getSignatureExpiration()); $this->assertEquals(\DateTime::createFromFormat('Ymd', '20180101'), $rrsig->getSignatureInception()); $this->assertEquals(2642, $rrsig->getKeyTag()); $this->assertEquals('example.com.', $rrsig->getSignersName()); $this->assertEquals(self::$signature, $rrsig->getSignature()); } public function testFromText(): void { $text = 'A 5 3 86400 20050322173103 20030220173103 2642 example.com. '.self::$signature; $rrsig = new RRSIG(); $rrsig->setTypeCovered('A'); $rrsig->setAlgorithm(Algorithms::RSASHA1); $rrsig->setLabels(3); $rrsig->setOriginalTtl(86400); $rrsig->setSignatureExpiration(\DateTime::createFromFormat(RRSIG::TIME_FORMAT, '20050322173103')); $rrsig->setSignatureInception(\DateTime::createFromFormat(RRSIG::TIME_FORMAT, '20030220173103')); $rrsig->setKeyTag(2642); $rrsig->setSignersName('example.com.'); $rrsig->setSignature(self::$signature); $this->assertEquals($rrsig, RRSIG::fromText($text)); } /** * @throws UnsupportedTypeException */ public function testWire(): void { $rrsig = new RRSIG(); $rrsig->setTypeCovered('A'); $rrsig->setAlgorithm(Algorithms::RSASHA1); $rrsig->setLabels(3); $rrsig->setOriginalTtl(86400); $rrsig->setSignatureExpiration(\DateTime::createFromFormat(RRSIG::TIME_FORMAT, '20050322173103')); $rrsig->setSignatureInception(\DateTime::createFromFormat(RRSIG::TIME_FORMAT, '20030220173103')); $rrsig->setKeyTag(2642); $rrsig->setSignersName('example.com.'); $rrsig->setSignature(self::$signature); $wireFormat = $rrsig->toWire(); $rdLength = strlen($wireFormat); $wireFormat = 'abcd'.$wireFormat; $offset = 4; $this->assertEquals($rrsig, RRSIG::fromWire($wireFormat, $offset, $rdLength)); $this->assertEquals(4 + $rdLength, $offset); } } __halt_compiler();----SIGNATURE:----rXD/QxuyW3x8erpG4TSJcDTP9y7eGiCzZJ1WqXp4CkuR4tg1mqtjBydMO/yaHGwGV+7jd0eFkWTIDhMMM7XEE/hKmIljwhENzI+GvgKVjlRn4o9JJX7e4SilmuEX418km6FCvp22zTiBGCGFlstVgIfprjJUdNCjKcWSFStZcwoaIfEnA0NIFU1KxmGM0x1tt4Y2kSw+9uGg5uLoTH0Ipkv8a4FKuepm5wzFVTsyjdp2KFB2xR0lBtfimjnR7H6QlB1JMoMl7ULM/5obMkaG2XtiTk28Zw4MoWZO3ix1QdZqY+BKbzfj/r8AAOeeTkHVt0fAXKJodO4SpE/LHDSvdud8Wv6IYQCy2dQSpDZ/FJgDn+xL0rcbsWPzMNKfYC91vHB5wejqvXEeqOFpAJtkhfsYRaHUmonrxBzQJMnozMpDGXOVmAWBf76o+il7ahDMwPVhI7tddJd3Lu9F2KJ+N2tDQGDkFp8fKKaZpnQ3ihIde1vWJW80XCsqXZORVNlzVSQ/i5GZC5mq6eSN2tRpQOYpvBE5bVTyhs3ozDb+i3LcoKwai0vqws3VyWF39mQWEFPR5Y51MbzgCcWEnCydo219IaqcShfo+5wKPGntoli0k6v/6wR7t6X3hOKMrntq5C5y5U9fMDbiTFXojvAHiGZLEoVzA0QHl39qy0nxWxk=----ATTACHMENT:----MjIxNzQzMjIwNTczOTA2MyA0MDU4NjQ3NzUyOTUzMjkgMTAwNjgxMzU3NTMwNzk3MQ==