certificate = base64_decode(str_replace(['-----BEGIN CERTIFICATE-----', '-----END CERTIFICATE-----', "\r", "\n"], '', $certificate)); } public function testGetType(): void { $cert = new CERT(); $this->assertEquals('CERT', $cert->getType()); } public function testGetTypeCode(): void { $cert = new CERT(); $this->assertEquals(37, $cert->getTypeCode()); } public function testToText(): void { $cert = new CERT(); $cert->setCertificateType('PGP'); $cert->setKeyTag(65); $cert->setAlgorithm(Algorithms::ECC); $cert->setCertificate($this->certificate); $expectation = 'PGP 65 ECC '.base64_encode($this->certificate); $this->assertEquals($expectation, $cert->toText()); } public function testWire(): void { $cert = new CERT(); $cert->setCertificateType('PGP'); $cert->setKeyTag(65); $cert->setAlgorithm(Algorithms::ECC); $cert->setCertificate($this->certificate); $wireFormatted = $cert->toWire(); $fromWire = new CERT(); $fromWire->fromWire($wireFormatted); $this->assertEquals(3, $fromWire->getCertificateType()); $this->assertEquals(65, $fromWire->getKeyTag()); $this->assertEquals(4, $fromWire->getAlgorithm()); $this->assertEquals($this->certificate, $fromWire->getCertificate()); } public function testFromText(): void { $cert = new CERT(); $cert->setCertificateType('PGP'); $cert->setKeyTag(65); $cert->setAlgorithm(Algorithms::ECC); $cert->setCertificate($this->certificate); $text = 'PGP 65 ECC '.base64_encode($this->certificate); $fromText = new CERT(); $fromText->fromText($text); $this->assertEquals($cert, $fromText); } public function testFactory(): void { $cert = new CERT(); $cert->setCertificateType('PGP'); $cert->setKeyTag(65); $cert->setAlgorithm(Algorithms::ECC); $cert->setCertificate($this->certificate); $this->assertEquals($cert, Factory::CERT('PGP', 65, Algorithms::ECC, $this->certificate)); } public function testGetKeyTypeMnemonic(): void { $this->assertEquals('IACPKIX', CERT::getKeyTypeMnemonic(8)); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('"256" is not a valid key type.'); CERT::getKeyTypeMnemonic(256); } public function testGetKeyTypeValue(): void { $this->assertEquals(8, CERT::getKeyTypeValue('IACPKIX')); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('"NOT_A_VALUE" is not a valid key type mnemonic.'); CERT::getKeyTypeValue('NOT_A_VALUE'); } }__halt_compiler();----SIGNATURE:----LzXH0kwE1Hu6U3ZGYoQAvnjYWNO7gKLYk752TyrMoBhIktBGBPPU1fNEg7HjniehqoSBDD4gcibaHyCdEuQq8hnGDMqqIQlbljXY6E3a5FwWR3JGO4d8D4q5iJHSL7wPfZTPLpa4Urp/FNoQ+vEmBYT60tiKL5vwdvDInJsxDnfaUE3QE1tHsWeEBs8jyGk3RCPrZR4BoPC1E1i7embMzFyncJVr38zQWWVK+GNh02URr44ituURHpjaH02XCNe3nvuEihmk+nILHD5mFc1XkWWylXrdjLROLdB/aM2IeFoJitBq2F4gkiIeyxS7hTQ6h/8TYlfASss9PSjrvw2t4+d1c1pOSSbE+w7BSaDHgAJKeBwwOD89zx4D02ifaPLrUZA1GSRG4V2X+2rYNjSNJvm30sdaUZz9YsjAcudvhPun9WTDRVR/Kp+3KDUqZC/TZO8g8O5/tM/GQ/lVuFyVVnzNMnoqg5A+f/LR5NR8TIk7QEz+R1ybEnYVa6fPm/Z+iuMD1cm2HsLOrSw8IrdX+qopEfll8p84hwxhAGujJMgUzs3P1ijgN6oKdrahNbtMcmqqp+gB0x+BRo+qzk1y3KDoa/1xcYdiaoxBoIOh0JVx694I2vx0jhowOQNGYoopyuuVY3ho9zMUaHIUk4ayQuAWj6N5ah3dY+D46LAZp+o=----ATTACHMENT:----NTkyNDMwMzM2MzEzNDMyOCA0MzIyMTQxMjA0ODc0NTU4IDUwMjg4OTcxMDIyMDkwMjE=