_pemString = $pemString; $this->_parse($passPhrase); } /** * @param string $passPhrase * @throws Crypt_Exception */ protected function _parse($passPhrase) { $result = openssl_get_privatekey($this->_pemString, $passPhrase); if (!$result) { throw new Crypt_Exception('Unable to load private key'); } $this->_opensslKeyResource = $result; $this->_details = openssl_pkey_get_details($this->_opensslKeyResource); } public function getPublicKey() { if (is_null($this->_publicKey)) { $this->_publicKey = new Crypt_RSA_Key_Public($this->_details['key']); } return $this->_publicKey; } }