signer = new Sha256(); } public function getSigner(): Signer { return $this->signer; } public function getPrivateKey(): Key { if ($this->privateKey === null) { $this->privateKey = InMemory::plainText($this->privateKeyPath, $this->privateKeyPass ?? ''); } return $this->privateKey; } public function getPublicKey(): Key { if ($this->publicKey === null) { $privateKey = $this->getPrivateKey(); $privateKeyOpenSSL = openssl_pkey_get_private($privateKey->contents(), $privateKey->passphrase()); $publicPem = openssl_pkey_get_details($privateKeyOpenSSL)['key']; $this->publicKey = InMemory::plainText($publicPem); } return $this->publicKey; } }