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