public function getKeyPair($file = false)
    {
        $pk = $this->_generatePK();

        openssl_pkey_export($pk, $privKey, null, $this->certConfigure);
        $pubKey = openssl_pkey_get_details($pk);

        $keys = new KeyPair();
        $keys->setPrivateKey($privKey)->setPublicKey($pubKey['key']);

        if ($file) {
            file_put_contents($this->fileName . static::PRIV_KEY_FILENAME , $keys->getPrivateKey());
            file_put_contents($this->fileName . static::PUB_KEY_FILENAME , $keys->getPublicKey());
        }

        return $keys;
    }
public function getKeyPair($file = false)
    {
        $pk = $this->_generatePK();

        openssl_pkey_export($pk, $privKey, null, $this->certConfigure);
        $pubKey = openssl_pkey_get_details($pk);

        $keys = new KeyPair();
        $keys->setPrivateKey($privKey)->setPublicKey($pubKey['key']);

        if ($file) {
            file_put_contents($this->fileName . static::PRIV_KEY_FILENAME , $keys->getPrivateKey());
            file_put_contents($this->fileName . static::PUB_KEY_FILENAME , $keys->getPublicKey());
        }

        return $keys;
    }
public function getKeyPair ( $ file = false ) { $ pk = $ this -> _generatePK ( ) ; openssl_pkey_export ( $ pk , $ privKey , null , $ this -> certConfigure ) ; $ pubKey = openssl_pkey_get_details ( $ pk ) ; $ keys = new KeyPair ( ) ; $ keys -> setPrivateKey ( $ privKey ) -> setPublicKey ( $ pubKey [ 'key' ] ) ; if ( $ file ) { file_put_contents ( $ this -> fileName . static :: PRIV_KEY_FILENAME , $ keys -> getPrivateKey ( ) ) ; file_put_contents ( $ this -> fileName . static :: PUB_KEY_FILENAME , $ keys -> getPublicKey ( ) ) ; } return $ keys ; }
Returns key pair
Returns key pair