---
name: "ssh_server_key_api"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/ssh_server_key_api"
---

# ssh\_server\_key\_api(3erl)

\-behaviour(ssh\_server\_key\_api).

## NAME

ssh\_server\_key\_api - \
     \-behaviour(ssh\_server\_key\_api).

## DESCRIPTION

Behaviour describing the API for public key handling of an SSH server. By implementing the callbacks defined in this behavior, the public key handling of an SSH server can be customized. By default the SSH application implements this behavior with help of the standard OpenSSH files, see the  [ssh(7)](/ssh/7.md) application manual.

## DATA TYPES

```
daemon_key_cb_options(T) =
    [{key_cb_private, [T]} | ssh:daemon_option()]
```

Options provided to ssh:daemon/2,3.

The option list given in the *key\_cb* option is available with the key *key\_cb\_private*.

## EXPORTS

**Module:host\_key(Algorithm, DaemonOptions) -\> {ok, PrivateKey} \| {error, Reason}**\

Types:

Algorithm = ssh:pubkey\_alg()\

Host key algorithm.

DaemonOptions = daemon\_key\_cb\_options()\
 PrivateKey = public\_key:private\_key() \| crypto:engine\_key\_ref()\

Private key of the host matching the *Algorithm*. It may be a reference to a 'ssh-rsa', rsa-sha2-\* or 'ssh-dss' (NOT ecdsa) key stored in a loaded Engine.

Reason = term()\

Fetches the private key of the host.

**Module:is\_auth\_key(PublicUserKey, User, DaemonOptions) -\> Result**\

Types:

PublicUserKey = public\_key:public\_key()\

Normally an RSA, DSA or ECDSA public key, but handling of other public keys can be added

User = string()\

User owning the public key.

DaemonOptions = daemon\_key\_cb\_options()\
 Result = boolean()\

Checks if the user key is authorized.
