mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@334762 c90b9560-bf6c-de11-be94-00142212c4b1
104 lines
2.7 KiB
XML
104 lines
2.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ssh2-fingerprint">
|
|
<refnamediv>
|
|
<refname>ssh2_fingerprint</refname>
|
|
<refpurpose>Retrieve fingerprint of remote server</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<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><initializer>SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns a server hostkey hash from an active session.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>session</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
An SSH connection link identifier, obtained from a call to
|
|
<function>ssh2_connect</function>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>flags</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<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>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the hostkey hash as a string.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<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>
|
|
</para>
|
|
</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:"~/.phpdoc/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
|
|
-->
|