(PECL ssh2 >= 0.9.0)
ssh2_methods_negotiated — 返回已協商方法的清單
範例 #1 判斷已協商哪些方法
<?php
$connection = ssh2_connect('shell.example.com', 22);
$methods = ssh2_methods_negotiated($connection);
echo "已使用以下方式協商加密金鑰:{$methods['kex']}\n";
echo "伺服器使用 {$methods['hostkey']} 進行識別,其 ";
echo "指紋為:" . ssh2_fingerprint($connection) . "\n";
echo "用戶端到伺服器的封包將使用以下方法:\n";
echo "\t加密:{$methods['client_to_server']['crypt']}\n";
echo "\t壓縮:{$methods['client_to_server']['comp']}\n";
echo "\t訊息鑑別碼:{$methods['client_to_server']['mac']}\n";
echo "伺服器到用戶端的封包將使用以下方法:\n";
echo "\t加密:{$methods['server_to_client']['crypt']}\n";
echo "\t壓縮:{$methods['server_to_client']['comp']}\n";
echo "\t訊息鑑別碼:{$methods['server_to_client']['mac']}\n";
?>