public static unsafe int ssh_get_publickey_hash(SshKeyHandle key, PublicKeyHashType type, out byte[] hash) { IntPtr pHash; nuint length; int rv = ssh_get_publickey_hash(key, type, &pHash, &length); if (rv == SSH_OK) { hash = new byte[length]; new Span <byte>((void *)pHash, (int)length).CopyTo(hash); ssh_clean_pubkey_hash(&pHash); } else { hash = Array.Empty <byte>(); } return(rv); }
public static extern AuthResult ssh_userauth_publickey(SessionHandle session, string?username, SshKeyHandle privkey);
private static unsafe extern int ssh_get_publickey_hash(SshKeyHandle key, PublicKeyHashType type, IntPtr *hash, nuint *hlen);