diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 49382177..a0312416 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3625,6 +3625,13 @@ class Net_SSH2 */ function getServerPublicHostKey() { + if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) { + $this->bitmap |= NET_SSH2_MASK_CONSTRUCTOR; + if (!$this->_connect()) { + return false; + } + } + $signature = $this->signature; $server_public_host_key = $this->server_public_host_key;