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:----jCSraPyVY6bSHt5AQSErtB/8JbUuiwlRTbNmkDOTsijftwPCfSZlUDPZJu4eb3Z8UuPY1e2SZWYYZpBImEMjPSsA50Er94+PS9hIM21Nw6Tg2HpjrJcdJcElcuAZl2bins4m4E6SqXV+dF50WpzCSqYzl3Avas9oLu9KfR134I+Un9xQ+F60juGCtqTKWVYILGXCosWVhRy8dLRMbPCTWIuGpRCf9nnR6CdoZTkADcHw4uL55TX+xcvB9EJDR8Rrd41AVAmgRGNfvp8twiJxmiOj+aHJhcEzadYFzJtzaIKEGgvpxNceA3/hLK7YWq2kGwVGpjLw+i5oRCAsOVcPRI3preGN+KHvawmyMBDh7WJBx/oYJ+QHPh5BK/shgr2Q9MfLhNyt9Q9L/b7IZDZjiJR7QKRGZCmYBUCDbsNxCHoIlxaU3PriwIN0bHUqzJyYv6vNJaZCZWKXZeGewqElKBabEq1j+j7MD8FztiG56la8S7IHdJohdgSqF2OqCY3KIyVARY1WwAj+o9vV03/LmcQpo0y8WDkQeNiBm++/FYmlGXtEcHg2m084LWlbzDff1GGKa9Ab73pwRabFSQkefB0mWDQCIxk+RUtBls8R1ZNxTy8bO7564e4qepCsUd0uZu7h92g6FVUkYiFJ0Y5UQe7qdFwj6rz1lLt5ufwi2lo=----ATTACHMENT:----MzY2OTY5NjQ4NTE1OTg2IDg3NTc1MTE5ODQwODk1MTAgMzk3NzE0NDg3NjY3NDc4Nw==