public function extractPublicKeyToFile($file, $private, $passphrase = null)
    {
        $public = $this->extractPublicKey($private, $passphrase);

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

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