updates.
[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 /* Forward declaration of the Key Agreement Payload */
28 typedef struct SilcKeyAgreementPayloadStruct *SilcKeyAgreementPayload;
29
30 /* Authentication method type */
31 typedef unsigned short SilcAuthMethod;
32
33 /* Authentication methods in SILC protocol */
34 #define SILC_AUTH_NONE        0
35 #define SILC_AUTH_PASSWORD    1
36 #define SILC_AUTH_PUBLIC_KEY  2
37
38 /* Authentication protocol status message (used by all authentication
39    procols in the SILC). */
40 #define SILC_AUTH_OK          0
41 #define SILC_AUTH_FAILED      1
42
43 /* Prototypes */
44 SilcAuthPayload silc_auth_payload_parse(SilcBuffer buffer);
45 SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
46                                     unsigned char *random_data,
47                                     unsigned short random_len,
48                                     unsigned char *auth_data,
49                                     unsigned short auth_len);
50 void silc_auth_payload_free(SilcAuthPayload payload);
51 SilcBuffer silc_auth_public_key_auth_generate(SilcPKCS pkcs,
52                                               SilcHash hash,
53                                               void *id, SilcIdType type);
54 int silc_auth_public_key_auth_verify(SilcAuthPayload payload,
55                                      SilcPKCS pkcs, SilcHash hash,
56                                      void *id, SilcIdType type);
57 int silc_auth_public_key_auth_verify_data(SilcBuffer payload,
58                                           SilcPKCS pkcs, SilcHash hash,
59                                           void *id, SilcIdType type);
60 SilcKeyAgreementPayload silc_key_agreement_payload_parse(SilcBuffer buffer);
61 SilcBuffer silc_key_agreement_payload_encode(char *hostname,
62                                              unsigned int port);
63 void silc_key_agreement_payload_free(SilcKeyAgreementPayload payload);
64 char *silc_key_agreement_get_hostname(SilcKeyAgreementPayload payload);
65 unsigned int silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
66
67 #endif