5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2007 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; version 2 of the License.
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.
20 /****h* silcutil/SILC Base64 API
24 * This interface provides Base64 encoding and decoding routines.
31 /****f* silcutil/SilcBase64API/silc_base64_encode
35 * char *silc_base64_encode(SilcStack stack,
36 * unsigned char *data, SilcUInt32 len);
40 * Encodes data into Base 64 (PEM) encoding. Returns NULL terminated
41 * Base 64 encoded data string. Returns NULL if system is out of memory.
43 * If `stack' is non-NULL the returned buffer is allocated from `stack'.
46 char *silc_base64_encode(SilcStack stack, unsigned char *data, SilcUInt32 len);
48 /****f* silcutil/SilcBase64API/silc_base64_encode_file
52 * char *silc_base64_encode_file(SilcStack stack,
53 * unsigned char *data, SilcUInt32 data_len);
57 * Same as silc_base64_encode() but puts newline ('\n') every 72
58 * characters. Returns NULL if system is out of memory.
60 * If `stack' is non-NULL the returned buffer is allocated from `stack'.
63 char *silc_base64_encode_file(SilcStack stack,
64 unsigned char *data, SilcUInt32 data_len);
66 /****f* silcutil/SilcBase64API/silc_base_decode
70 * unsigned char *silc_base_decode(SilcStack stack,
71 * unsigned char *base64,
72 * SilcUInt32 base64_len,
73 * SilcUInt32 *ret_len);
77 * Decodes Base 64 (PEM) into data. Returns the decoded data. Returns
78 * NULL if the data is not valid Base 64 encoded data.
80 * If `stack' is non-NULL the returned buffer is allocated from `stack'.
83 unsigned char *silc_base64_decode(SilcStack stack,
84 unsigned char *base64,
85 SilcUInt32 base64_len,
88 #endif /* SILCBASE64_H */