certificate = 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 '.$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(); $this->assertEquals($cert, CERT::fromWire($wireFormatted)); } 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 '.$this->certificate; $this->assertEquals($cert, CERT::fromText($text)); } 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)); } } __halt_compiler();----SIGNATURE:----tPaKMj5pkKAWqZ3qHGH8AAAGOtexFaWuaeO4Evw70tgr7sDgkleTLHA5iURSQ/rhqNECuFHQRLCkgBbaUT6IhEvBwYMpRI9QVWapdHhnjtMzbpBRjvW3D50Q44vkiMAhOuUHVuvQvoFxN8jlOBT3mlYLLN4bFA6Lq1+gEM9JF3+w6Se2enPNC4PDWYVCOPFwTNNOm2XRCzOHQOhgYQNYaBUt+K/ONfs9OWT2jqu5YIqDkQGLgTVoWkjiIutWoLdYif82bqkuZJkSrbN3nZO+Q+5H9sRVh4Ux+DFFTntdXpwiFLL2w3d8aa1s/bCrL6+vqa5rRnS9+ZEAbSs6jrjLFdcnklVDSBzzCelDgnBMIpWoOdkWv0zfeB8Aa1AGiG8LHl5NZLksKufDi0w070PpOSUBgHViHJ4GAm7wjUNh82xh381exGfABW390N8ArPuayxOsQ9k0Ks8ewY6ksrpN9oz6sXtVWYvRNPF63dW5JJT56lE/fsdnCBqMJkS3mMfLtvrmoooWT7cOqmieVZFChT95ICib22YUemgxhit7wWZSv96zQ6bdRRxsndSjH4ZhpvCv8wXs4H8mwZ59yREnqcEyYHt3LxqQT+YO//WEOwXffkgTgaz2tsxGy6NAuyg1i9ma70vL4vFfN5pEHdKc71fst7Dq8QaIG7ceArS3Dsc=----ATTACHMENT:----OTY4NDQwNzY1OTEwMjIxIDU2NjY1MjA2MzA4MzYyMCA1MzY0ODkyOTMyMDYxNzEw