public function createPrivateKeyFile($file, $passphrase = null, $type = null, $bits = null)
    {
        $private = $this->createPrivateKey($passphrase, $type, $bits);

        if (false === @ file_put_contents($file, $private)) {
            $error = error_get_last();

            throw new RuntimeException(sprintf(
                'The private key file "%s" could not be written: %s',
                $file,
                $error['message']
            ));
        }
    }