76ceb536d67c3f98b3791046f0b0df7683ae52a2
[crypto.git] / lib / silcske / silcconnauth.h
1 /*
2
3   silcconnauth.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2005 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 /****h* silcske/SILC Connection Authentication
21  *
22  * DESCRIPTION
23  *
24  * SILC Connection Authentication protocol is closely related to the SILC
25  * Key Exchange protocol.  After successful key exchange, additional
26  * authentication is usually required to gain access to remote server or
27  * service.  Connection authentication may be based on passphrase or
28  * digital signatures.  It is also possible to have no authentication at
29  * all.
30  *
31  ***/
32
33 #ifndef SILCCONNAUTH_H
34 #define SILCCONNAUTH_H
35
36 typedef struct SilcConnAuthStruct *SilcConnAuth;
37
38 typedef enum {
39   SILC_CONN_UNKNOWN  = 0,
40   SILC_CONN_CLIENT   = 1,       /* Client connection */
41   SILC_CONN_SERVER   = 2,       /* Server connection */
42   SILC_CONN_ROUTER   = 3        /* Router connection */
43 } SilcConnectionType;
44
45 typedef SilcBool (*SilcConnAuthGetAuthData)(SilcConnAuth connauth,
46                                             SilcConnectionType conn_type,
47                                             unsigned char **passphrase,
48                                             SilcUInt32 *passphrase_len,
49                                             SilcSKR *repository,
50                                             void *context);
51
52 typedef void (*SilcConnAuthCompletion)(SilcConnAuth connauth,
53                                        SilcBool success,
54                                        void *context);
55
56 SilcConnAuth silc_connauth_alloc(SilcSchedule schedule,
57                                  SilcSKE ske,
58                                  SilcUInt32 timeout_secs);
59 void silc_connauth_free(SilcConnAuth connauth);
60 SilcSKE silc_connauth_get_ske(SilcConnAuth connauth);
61 SilcAsyncOperation
62 silc_connauth_initiator(SilcConnAuth connauth,
63                         SilcConnectionType conn_type,
64                         SilcAuthMethod auth_method, void *auth_data,
65                         SilcUInt32 auth_data_len,
66                         SilcConnAuthCompletion completion,
67                         void *context);
68 SilcAsyncOperation
69 silc_connauth_responder(SilcConnAuth connauth,
70                         SilcConnAuthGetAuthData get_auth_data,
71                         SilcConnAuthCompletion completion,
72                         void *context);
73
74 #endif /* SILCCONNAUTH_H */