created.
[silc.git] / lib / silccore / silcauth.h
1 /*
2
3   siclauth.h
4
5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6
7   Copyright (C) 2001 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; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20
21 #ifndef SILCAUTH_H
22 #define SILCAUTH_H
23
24 /* Forward declaration of the Authentication Payload */
25 typedef struct SilcAuthPayloadStruct *SilcAuthPayload;
26
27 /* Authentication method type */
28 typedef unsigned short SilcAuthMethod;
29
30 /* Authentication methods in SILC protocol */
31 #define SILC_AUTH_NONE        0
32 #define SILC_AUTH_PASSWORD    1
33 #define SILC_AUTH_PUBLIC_KEY  2
34
35 /* Authentication protocol status message (used by all authentication
36    procols in the SILC). */
37 #define SILC_AUTH_OK          0
38 #define SILC_AUTH_FAILED      1
39
40 /* Prototypes */
41 SilcAuthPayload silc_auth_payload_parse(SilcBuffer buffer);
42 SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
43                                     unsigned char *random_data,
44                                     unsigned short random_len,
45                                     unsigned char *auth_data,
46                                     unsigned short auth_len);
47 void silc_auth_payload_free(SilcAuthPayload payload);
48 SilcBuffer silc_auth_public_key_auth_generate(SilcPKCS pkcs,
49                                               SilcHash hash);
50 int silc_auth_public_key_auth_verify(SilcAuthPayload paylaod,
51                                      SilcPKCS pkcs, SilcHash hash);
52 int silc_auth_public_key_auth_verify_data(SilcBuffer payload,
53                                           SilcPKCS pkcs, SilcHash hash);
54
55 #endif