PHP 8.4.6 Released!

ssh2_fingerprint

(PECL ssh2 >= 0.9.0)

ssh2_fingerprintRecupera la huella de un servidor remoto

Descripción

ssh2_fingerprint(resource $session, int $flags = SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX): string

Recupera la huella de un servidor remoto.

Parámetros

session

Un identificador de conexión SSH, obtenido desde la función ssh2_connect().

flags

flags puede ser SSH2_FINGERPRINT_MD5 o SSH2_FINGERPRINT_SHA1 asociado lógicamente con SSH2_FINGERPRINT_HEX o SSH2_FINGERPRINT_RAW.

Valores devueltos

Devuelve la huella, en forma de string.

Ejemplos

Ejemplo #1 Comparación de una huella con un valor conocido

<?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" .
"Posible ataque Man-In-The-Middle ?");
}
?>

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant