Merge commit 'origin/silc.1.1.branch'
[silc.git] / lib / silccore / silcpubkey.h
1 /*
2
3   silcpubkey.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2005 - 2007 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* silccore/SILC Public Key Payload
21  *
22  * DESCRIPTION
23  *
24  * Implementation of the Public Key Payload.  Public Key Payload is used to
25  * deliver different types of public keys and certificates in the SILC
26  * protocol.
27  *
28  ***/
29
30 #ifndef SILCPUBKEY_H
31 #define SILCPUBKEY_H
32
33 /****f* silccore/SilcPubKeyAPI/silc_public_key_payload_encode
34  *
35  * SYNOPSIS
36  *
37  *    SilcBuffer silc_public_key_payload_encode(SilcStack stack,
38  *                                              SilcPublicKey public_key);
39  *
40  * DESCRIPTION
41  *
42  *    Encodes the Public Key Payload from the public key indicated by
43  *    `public_key'.  Returns the allocated and encoded payload buffer,
44  *    or NULL on error.
45  *
46  *    If `stack' is non-NULL the returned buffer is allocated from `stack'.
47  *    This call will consume the `stack' so caller should push the stack
48  *    before calling and then later pop it.
49  *
50  ***/
51 SilcBuffer silc_public_key_payload_encode(SilcStack stack,
52                                           SilcPublicKey public_key);
53
54 /****f* silccore/SilcPubKeyAPI/silc_public_key_payload_decode
55  *
56  * SYNOPSIS
57  *
58  *    SilcBool silc_public_key_payload_decode(unsigned char *data,
59  *                                            SilcUInt32 data_len,
60  *                                            SilcPublicKey *public_key);
61  *
62  * DESCRIPTION
63  *
64  *    Decodes Public Key Payload from `data' of `data_len' bytes in length
65  *    data buffer into `public_key' pointer.  Returns FALSE if the payload
66  *    cannot be decoded.
67  *
68  ***/
69 SilcBool silc_public_key_payload_decode(unsigned char *data,
70                                         SilcUInt32 data_len,
71                                         SilcPublicKey *public_key);
72
73 #endif /* SILCPUBKEY_H */