Add example for ssh2_auth_pubkey_file()

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@175744 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sara Golemon 2004-12-28 03:25:39 +00:00
parent 40c6bb57e3
commit 1c8a3b04fd

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.ssh2-auth-pubkey-file">
<refnamediv>
@ -15,13 +15,33 @@
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
<methodparam><type>string</type><parameter>username</parameter></methodparam>
<methodparam><type>string</type><parameter>pubkeyfile</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>privkeyfile</parameter></methodparam>
<methodparam><type>string</type><parameter>privkeyfile</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>passphrase</parameter></methodparam>
</methodsynopsis>
<para>
Authenticate using a public key read from a file.
</para>
<simpara>
Authenticate using a public key read from a file. If <parameter>privkeyfile</parameter>
is encrypted (which it should be), the passphrase must be provided.
</simpara>
<example>
<title>Authentication using a public key</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
if (ssh2_auth_pubkey_file($connection, 'username',
'/home/username/.ssh/id_rsa.pub',
'/home/username/.ssh/id_rsa', 'secret')) {
echo "Public Key Authentication Successful\n";
} else {
die('Public Key Authentication Failed');
}
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>