pollita Mon Dec 27 18:38:15 2004 EDT
Modified files:
/phpdoc/en/reference/ssh2/functions ssh2-fingerprint.xml
Log:
Flesh out ssh2_fingerprint() docs.
http://cvs.php.net/diff.php/phpdoc/en/reference/ssh2/functions/ssh2-fingerprint.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/ssh2/functions/ssh2-fingerprint.xml
diff -u phpdoc/en/reference/ssh2/functions/ssh2-fingerprint.xml:1.1
phpdoc/en/reference/ssh2/functions/ssh2-fingerprint.xml:1.2
--- phpdoc/en/reference/ssh2/functions/ssh2-fingerprint.xml:1.1 Fri Dec 24
20:03:17 2004
+++ phpdoc/en/reference/ssh2/functions/ssh2-fingerprint.xml Mon Dec 27
18:38:14 2004
@@ -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-fingerprint">
<refnamediv>
@@ -12,14 +12,45 @@
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>ssh2_fingerprint</methodname>
- <methodparam
choice="opt"><type>resource</type><parameter>session</parameter></methodparam>
+
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
- <para>
+ <simpara>
Returns a server hostkey hash from an active session
Defaults to MD5 fingerprint encoded as ASCII hex values
- </para>
+ </simpara>
+
+ <simpara>
+ <parameter>flags</parameter> may be either of
+ <constant>SSH2_FINGERPRINT_MD5</constant> or
+ <constant>SSH2_FINGERPRINT_SHA1</constant> logically ORed with
+ <constant>SSH2_FINGERPRINT_HEX</constant> or
+ <constant>SSH2_FINGERPRINT_RAW</constant>.
+ Defaults to <constant>SSH2_FINGERPRINT_MD5</constant> |
+ <constant>SSH2_FINGERPRINT_HEX</constant>.
+ </simpara>
+
+ <example>
+ <title>Checking the fingerprint against a known value</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$known_host = '6F89C2F0A719B30CC38ABDF90755F2E4';
+
+$connection = ssh2_connect('shell.example.com', 22);
+
+$fingerprint = ssh2_fingerprint($connection,
+ SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX);
+
+if ($fingerprint != $known_host) {
+ die("HOSTKEY MISMATCH!\n" .
+ "Possible Man-In-The-Middle Attack?");
+}
+?>
+]]>
+ </programlisting>
+ </example>
</refsect1>
</refentry>