1ssh_client_key_api(3)      Erlang Module Definition      ssh_client_key_api(3)
2
3
4

NAME

6       ssh_client_key_api -
7            -behaviour(ssh_client_key_api).
8
9

DESCRIPTION

11       Behavior  describing  the API for public key handling of an SSH client.
12       By implementing the callbacks defined in this behavior, the public  key
13       handling  of an SSH client can be customized. By default the ssh appli‐
14       cation implements this behavior  with  help  of  the  standard  OpenSSH
15       files, see the  ssh(6) application manual.
16

DATA TYPES

18       client_key_cb_options(T) =
19           [{key_cb_private, [T]} | ssh:client_option()]
20
21              Options provided to ssh:connect/[3,4].
22
23              The option list given in the key_cb option is available with the
24              key key_cb_private.
25

EXPORTS

27       Module:add_host_key(HostNames, PublicHostKey, ConnectOptions) ->  ok  |
28       {error, Reason}
29
30              Types:
31
32                 HostNames = string()
33                   Description of the host that owns the PublicHostKey.
34                 PublicHostKey = public_key:public_key()
35                   Of  ECDSA keys, only the Normally an RSA, DSA or ECDSA pub‐
36                   lic key, but handling of other public keys can be added.
37                 ConnectOptions = client_key_cb_options()
38
39              This function is retired  in  favour  for  Module:add_host_key/4
40              which is the preferred API function. The calling SSH application
41              will still try the add_host_key/3 if the call to  add_host_key/4
42              failed.
43
44              Adds a host key to the set of trusted host keys.
45
46       Module:add_host_key(Host,  Port, PublicHostKey, ConnectOptions) -> ok |
47       {error, Reason}
48
49              Types:
50
51                 Host = inet:ip_address() | inet:hostname()  |  [  inet:ip_ad‐
52                 dress() | inet:hostname() ]
53                   The  host  that  owns the PublicHostKey. One or more IP ad‐
54                   dresses or hostnames.
55                 Port = inet:port_number()
56                   The Port number of the Host.
57                 PublicHostKey = public_key:public_key()
58                   Of ECDSA keys, only the Normally an RSA, DSA or ECDSA  pub‐
59                   lic key, but handling of other public keys can be added.
60                 ConnectOptions = client_key_cb_options()
61
62              Adds a host key to the set of trusted host keys.
63
64              This  function  is  preferred  to  the old Module:add_host_key/3
65              since it also uses the peer host port number and may  return  an
66              error message.
67
68              The  OTP/SSH  application first calls this function in the call‐
69              back module, and then the old Module:add_host_key/3 for compati‐
70              bility.
71
72       Module:is_host_key(Key, Host, Algorithm, ConnectOptions) -> Result
73
74              Types:
75
76                 Key = public_key:public_key()
77                   Normally  an  RSA, DSA or ECDSA public key, but handling of
78                   other public keys can be added.
79                 Host = string()
80                   Description of the host.
81                 Algorithm = ssh:pubkey_alg()
82                   Host key algorithm.
83                 ConnectOptions = client_key_cb_options()
84                 Result = boolean()
85
86              This function is  retired  in  favour  for  Module:is_host_key/5
87              which is the preferred API function. The calling SSH application
88              will still try the is_host_key/4 if the  call  to  is_host_key/5
89              failed.
90
91              Checks if a host key is trusted.
92
93       Module:is_host_key(Key,  Host,  Port, Algorithm, ConnectOptions) -> Re‐
94       sult
95
96              Types:
97
98                 Key = public_key:public_key()
99                   Normally an RSA, DSA or ECDSA public key, but  handling  of
100                   other public keys can be added.
101                 Host  =  inet:ip_address()  | inet:hostname() | [ inet:ip_ad‐
102                 dress() | inet:hostname() ]
103                   Description of the host with one or more  IP  addresses  or
104                   hostnames.
105                 Port = inet:port_number()
106                   The Port number of the host.
107                 Algorithm = ssh:pubkey_alg()
108                   Host key algorithm.
109                 ConnectOptions = client_key_cb_options()
110                 Result = boolean() | {error, Error::term()}
111                   The exact error message depends on the actual callback mod‐
112                   ule. The Error message makes the connection to fail, and is
113                   returned from e.g ssh:connect/3.
114
115              Checks if a host key is trusted.
116
117              This function is preferred to the old Module:is_host_key/4 since
118              it also uses the peer host port number and may return  an  error
119              message.
120
121              The  OTP/SSH  application first calls this function in the call‐
122              back module, and then the old Module:is_host_key/4 for  compati‐
123              bility.
124
125       Module:user_key(Algorithm, ConnectOptions) -> Result
126
127              Types:
128
129                 Algorithm = ssh:pubkey_alg()
130                   Host key algorithm.
131                 ConnectOptions = client_key_cb_options()
132                 Result  = {ok, public_key:private_key()} | {ok, {ssh2_pubkey,
133                 PubKeyBlob :: binary()}} | {error, term()}
134
135              Fetches the users public key matching the  Algorithm.  Some  key
136              callback  modules  may  return  {ssh2_pubkey,  PubKeyBlob :: bi‐
137              nary()}.
138
139          Note:
140              The private key contains the public key.
141
142
143
144
145Ericsson AB                       ssh 4.15.3             ssh_client_key_api(3)
Impressum