#include "platform/libssh_util.h" #include namespace roro::sshutil { std::string fingerprintOf(ssh_session s) { ssh_key key = nullptr; unsigned char* hash = nullptr; size_t len = 0; std::string out; if (ssh_get_server_publickey(s, &key) == SSH_OK && ssh_get_publickey_hash(key, SSH_PUBLICKEY_HASH_SHA256, &hash, &len) == SSH_OK) { if (char* text = ssh_get_fingerprint_hash(SSH_PUBLICKEY_HASH_SHA256, hash, len)) { out = text; // "SHA256:..." ssh_string_free_char(text); } ssh_clean_pubkey_hash(&hash); } if (key) ssh_key_free(key); return out; } void startLibrary() { static bool started = false; if (!started) libssh_begin(); started = true; } } // namespace roro::sshutil