From 1c8a3b04fdb3541f989e6253c497372f936cc252 Mon Sep 17 00:00:00 2001 From: Sara Golemon <pollita@php.net> Date: Tue, 28 Dec 2004 03:25:39 +0000 Subject: [PATCH] Add example for ssh2_auth_pubkey_file() git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@175744 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../ssh2/functions/ssh2-auth-pubkey-file.xml | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/reference/ssh2/functions/ssh2-auth-pubkey-file.xml b/reference/ssh2/functions/ssh2-auth-pubkey-file.xml index 6a8522b812..8284a4272d 100644 --- a/reference/ssh2/functions/ssh2-auth-pubkey-file.xml +++ b/reference/ssh2/functions/ssh2-auth-pubkey-file.xml @@ -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>