Files
archived-doc-pt-br/reference/ssh2/functions/ssh2-fingerprint.xml
Leonardo Lara Rodrigues 4baf074b52 sync file lines with en rev
2026-01-27 09:14:27 -03:00

100 lines
2.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 12f0e72200ea9249d0fc2f118528bd24b24c44a6 Maintainer: leonardolara Status: ready --><!-- CREDITS: leonardolara -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ssh2-fingerprint">
<refnamediv>
<refname>ssh2_fingerprint</refname>
<refpurpose>Recupera a impressão digital do servidor remoto</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>
<simpara>
Retorna um hash de chave de host do servidor de uma sessão ativa.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<simpara>
Um identificador de conexão SSH, obtido de uma chamada a
<function>ssh2_connect</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<simpara>
<parameter>flags</parameter> podem ser
<constant>SSH2_FINGERPRINT_MD5</constant> ou
<constant>SSH2_FINGERPRINT_SHA1</constant> com operação lógica OR com
<constant>SSH2_FINGERPRINT_HEX</constant> ou
<constant>SSH2_FINGERPRINT_RAW</constant>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Retorna o hash da chave do host como uma string.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Verificando a impressão digital em relação a um valor conhecido</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("CHAVE DO HOST NÃO CORRESPONDE!\n" .
"Possível ataque Man-In-The-Middle?");
}
?>
]]>
</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:"~/.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
-->