<?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.3 $ --> <!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. --> <refentry id="function.ssh2-fingerprint"> <refnamediv> <refname>ssh2_fingerprint</refname> <refpurpose> Retreive fingerprint of remote server </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>ssh2_fingerprint</methodname> <methodparam><type>resource</type><parameter>session</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam> </methodsynopsis> <simpara> Returns a server hostkey hash from an active session. Defaults to MD5 fingerprint encoded as ASCII hex values. </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> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->