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:----KypqXPJhtlkxdibn9aIi96EHpV0q9vOyQ7GxK8X+RHzwQPS3eAUHKvgeBF1z/y/qR04ur+nIo9fSmOxypsX1+DrgRNzygmVOcHXrOzrA0EmUDkjGc/JK36qJg5setpyyC3dl3mF7h4s72DGQ0YGkL16MX+nXOlBqsXvEZ3Qf4X3D66qX5WIZWfIQVHc/NYjqkzRIv+9eAAuApU1q2No6CIpoIgjo1ME4JnSngiJDHFsmxtlNQl3xqd+9hiPewMgXA1LduZTL6VY+tLtbxyQBY8pnceERj3O+T3KrubKX5+5uuMSxRvEYQ6sFFuSRY97hbAYukHjJZxyFUVZFrlyjRKDe02wyv9C//w1ItWd8mWcumEYRa6aRtsFicF/6C/MRLwMPlfhuQdCk8RFUlPmJzw1U01AAlTA5peOhtvrdmKHiukUkCa9/FZG+Y0x/Q25gv2Xvsz9vQAzdmdQDE/aAWeIyD3x0baUDpDZeCfqV6fPTHdXygqezqhHOPhq8JnTQaHdnH7dXK2+K6m3ALXn/7bgEuc7zmlYuTsUnC2ldTVhV2AxMWNU7bH1TqrKLWEsjqSoQ+KanJxrS+dMerW9RNtKNqUk5NIKsKWpXDXguXrujq1FzuGe9zUj/fYSWGdTk+RPFy0dRe/Y8Jq6HrvQ++ThtqroVPb0iLwcIGr1V458=----ATTACHMENT:----OTkyNjIxOTk4Nzk0NjYwOCA0MTQxNzQ1MzQ3MTQzMzk4IDQzMjg5NjExNTQ2OTMzMjE=