5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 2001 Pekka Riikonen
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.
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.
24 /* Forward declaration of the Authentication Payload */
25 typedef struct SilcAuthPayloadStruct *SilcAuthPayload;
27 /* Forward declaration of the Key Agreement Payload */
28 typedef struct SilcKeyAgreementPayloadStruct *SilcKeyAgreementPayload;
30 /* Authentication method type */
31 typedef unsigned short SilcAuthMethod;
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
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
44 SilcAuthPayload silc_auth_payload_parse(unsigned char *data,
45 unsigned int data_len);
46 SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
47 unsigned char *random_data,
48 unsigned short random_len,
49 unsigned char *auth_data,
50 unsigned short auth_len);
51 void silc_auth_payload_free(SilcAuthPayload payload);
52 SilcAuthMethod silc_auth_get_method(SilcAuthPayload payload);
53 unsigned char *silc_auth_get_data(SilcAuthPayload payload,
54 unsigned int *auth_len);
55 SilcBuffer silc_auth_public_key_auth_generate(SilcPublicKey public_key,
56 SilcPrivateKey private_key,
58 void *id, SilcIdType type);
59 int silc_auth_public_key_auth_verify(SilcAuthPayload payload,
60 SilcPublicKey public_key, SilcHash hash,
61 void *id, SilcIdType type);
62 int silc_auth_public_key_auth_verify_data(SilcBuffer payload,
63 SilcPublicKey public_key,
65 void *id, SilcIdType type);
66 int silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
67 void *auth_data, unsigned int auth_data_len,
68 SilcHash hash, void *id, SilcIdType type);
69 int silc_auth_verify_data(unsigned char *payload, unsigned int payload_len,
70 SilcAuthMethod auth_method, void *auth_data,
71 unsigned int auth_data_len, SilcHash hash,
72 void *id, SilcIdType type);
73 SilcKeyAgreementPayload silc_key_agreement_payload_parse(SilcBuffer buffer);
74 SilcBuffer silc_key_agreement_payload_encode(char *hostname,
76 void silc_key_agreement_payload_free(SilcKeyAgreementPayload payload);
77 char *silc_key_agreement_get_hostname(SilcKeyAgreementPayload payload);
78 unsigned int silc_key_agreement_get_port(SilcKeyAgreementPayload payload);