1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2011-2018. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21-module(ssh_server_key_api).
22
23-include_lib("public_key/include/public_key.hrl").
24-include("ssh.hrl").
25
26-export_type([daemon_key_cb_options/1]).
27
28%%%****************************************************************
29%%% The option key_cb_private is to pass options needed by other
30%%% callback modules than the default ssh_file.erl
31%%%
32%%% If ssh:deamon(n, [ {key_cb_private, {hi,{there}}} ]
33%%% is called, the term() will be {hi,{there}}
34
35-type daemon_key_cb_options(T) :: [{key_cb_private,[T]} | ssh:daemon_option()].
36
37
38%%%****************************************************************
39%%% Fetch the host's private key that is of type Algorithm.
40
41-callback host_key(Algorithm :: ssh:pubkey_alg(),
42		   DaemonOptions :: daemon_key_cb_options(any())
43                  ) ->
44    {ok, PrivateKey :: public_key:private_key()} | {error, term()}.
45
46%%%****************************************************************
47%%% Check that PublicKey is known to be a public key for the User
48
49-callback is_auth_key(PublicKey :: public_key:public_key(),
50		      User :: string(),
51		      DaemonOptions :: daemon_key_cb_options(any())
52                     ) ->
53    boolean().
54