public function createPassphraseFile($passphrase, $passphraseFile, $privateKeyFile, $privateKeyPassphrase)
	{
		$privateKey = openssl_get_privatekey(file_get_contents($privateKeyFile), $privateKeyPassphrase);

		if (!$privateKey)
		{
			throw new \RuntimeException("Failed to load private key.");
		}

		$crypted = '';

		if (!openssl_private_encrypt($passphrase, $crypted, $privateKey))
		{
			throw new \RuntimeException("Failed to encrypt data using private key.");
		}

		return file_put_contents($passphraseFile, $crypted);
	}
public function createPassphraseFile($passphrase, $passphraseFile, $privateKeyFile, $privateKeyPassphrase)
	{
		$privateKey = openssl_get_privatekey(file_get_contents($privateKeyFile), $privateKeyPassphrase);

		if (!$privateKey)
		{
			throw new \RuntimeException("Failed to load private key.");
		}

		$crypted = '';

		if (!openssl_private_encrypt($passphrase, $crypted, $privateKey))
		{
			throw new \RuntimeException("Failed to encrypt data using private key.");
		}

		return file_put_contents($passphraseFile, $crypted);
	}
public function createPassphraseFile ( $ passphrase , $ passphraseFile , $ privateKeyFile , $ privateKeyPassphrase ) { $ privateKey = openssl_get_privatekey ( file_get_contents ( $ privateKeyFile ) , $ privateKeyPassphrase ) ; if ( ! $ privateKey ) { throw new \ RuntimeException ( "Failed to load private key." ) ; } $ crypted = '' ; if ( ! openssl_private_encrypt ( $ passphrase , $ crypted , $ privateKey ) ) { throw new \ RuntimeException ( "Failed to encrypt data using private key." ) ; } return file_put_contents ( $ passphraseFile , $ crypted ) ; }
Create a passphrase file

@param   string  $passphrase            The passphrase to store in the passphrase file.
@param   string  $passphraseFile        Path to the passphrase file to create.
@param   string  $privateKeyFile        Path to the private key file to encrypt the passphrase file.
@param   string  $privateKeyPassphrase  The passphrase for the private key.

@return  boolean  Result of writing the passphrase file to disk.

@since   1.0
@throws  \RuntimeException
Create a passphrase file