public function generate()
    {
        // Make a new key pair
        /** @var resource $private_key */
        $private_key = openssl_pkey_new([
            'private_key_bits'      => 2048,
            'private_key_type'      => OPENSSL_KEYTYPE_RSA,
            'encrypt_key'           => false,
        ]);

        // Export the key pair to a string
        $this->private_key_text = '';
        openssl_pkey_export($private_key, $this->private_key_text);

        // Get the public key
        $public_key_data       = openssl_pkey_get_details($private_key);
        $this->public_key_text = $public_key_data['key'];

        return $this;
    }
public function generate()
    {
        // Make a new key pair
        /** @var resource $private_key */
        $private_key = openssl_pkey_new([
            'private_key_bits'      => 2048,
            'private_key_type'      => OPENSSL_KEYTYPE_RSA,
            'encrypt_key'           => false,
        ]);

        // Export the key pair to a string
        $this->private_key_text = '';
        openssl_pkey_export($private_key, $this->private_key_text);

        // Get the public key
        $public_key_data       = openssl_pkey_get_details($private_key);
        $this->public_key_text = $public_key_data['key'];

        return $this;
    }
public function generate ( ) { // Make a new key pair /** @var resource $private_key */ $ private_key = openssl_pkey_new ( [ 'private_key_bits' => 2048 , 'private_key_type' => OPENSSL_KEYTYPE_RSA , 'encrypt_key' => false , ] ) ; // Export the key pair to a string $ this -> private_key_text = '' ; openssl_pkey_export ( $ private_key , $ this -> private_key_text ) ; // Get the public key $ public_key_data = openssl_pkey_get_details ( $ private_key ) ; $ this -> public_key_text = $ public_key_data [ 'key' ] ; return $ this ; }
Create the key pair.

@return KeyPair provides a fluent interface
Create the key pair .