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:----rnsRsUBG6+Zhgpu5OWEIprIR0gruVUYHrsOHY5aemVcIKxF6/5+nI0+FFFcjMN8ITQOLYQSjcc5otQkIc2JMX7iQgE1vCFneV02VaH59s5KzoYin77uZfzjx4sjdklrHURdYribOLwY/FsDcCH+YlTBWrS/0XYXluMx54SAw+i+8OPt//xEoEZb3n15WMXPFDBe4mSb2cYJsV5l14zNrQosbNHd5DGYKT21RebzCblxg7BABsON48Wzfu0ZRKaVb9Ie4OZw4VvaRmM0pvMy4coRaoGzE32My5/BTSffAJolnkM3s/CW6jiQvyeg0yXH3dPG6Np9tQXpzxPVvW1EMOQ6fhxmtiDynKvmSigBgWfEju37cVvq70pOetIIVnnaQdC+WJknRFuz7xlcDt6IrkhigYyfdMNipfjgPEf8sFfa+9PQeFAnk5LLmH5NdSNtglteRh+Bho6UOonEZveFbF57fYxDzEVDQPs5swsY6OO0zp6E3ozOXZJMdP1FocvVD/JLoJ6l+GUix9X1qjr4HAGd3wSvluvkdFRpSEHkH0KKh1GwvWYoBrT10GfKpGN3JeaTeYwvHQx91zhGYSVYjizR5Llgvo8KCR84ZEuMqpwexiZi/cqjoZOCGPTrGJf/Zyb9mK5gJhKTeIy/FKGppHzPi1tMa4LPdOjGv3cWwuYo=----ATTACHMENT:----NTQzNDA2MTY4MDAzMjg4IDgyOTIyOTA0NzI4MTYwODEgNDM0MDE0NzMxNzU5NDE4MQ==