ESAPI-C 1.0
The OWASP Enterprise Security API for C
|
00001 00009 /* 00010 base64.h -- Encode binary data using printable characters. 00011 Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. 00012 Written by Simon Josefsson. 00013 00014 This program is free software; you can redistribute it and/or modify 00015 it under the terms of the GNU General Public License as published by 00016 the Free Software Foundation; either version 2, or (at your option) 00017 any later version. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program; if not, write to the Free Software Foundation, 00026 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00027 */ 00028 00029 #ifndef BASE64_H 00030 # define BASE64_H 00031 00032 /* Get size_t. */ 00033 # include <stddef.h> 00034 00035 /* Get bool. */ 00036 # include <stdbool.h> 00037 00043 # define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4) 00044 00048 extern bool isbase64(char ch); 00049 00053 extern void base64_encode(const char *, size_t, char *, size_t); 00054 00055 extern size_t base64_encode_alloc(const char *, size_t, char **); 00056 00060 extern bool base64_decode(const char *, size_t, char *, size_t *); 00061 00062 extern bool base64_decode_alloc(const char *, size_t, char **, size_t *); 00063 00064 #endif /* BASE64_H */ 00065