1 /*************************************************************************** 2 begin : Thu May 06 2004 3 copyright : (C) 2004 by Martin Preuss 4 email : martin@libchipcard.de 5 6 *************************************************************************** 7 * * 8 * This library is free software; you can redistribute it and/or * 9 * modify it under the terms of the GNU Lesser General Public * 10 * License as published by the Free Software Foundation; either * 11 * version 2.1 of the License, or (at your option) any later version. * 12 * * 13 * This library 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 GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library; if not, write to the Free Software * 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 21 * MA 02111-1307 USA * 22 * * 23 ***************************************************************************/ 24 25 26 #ifndef GWENHYWFAR_BASE64_H 27 #define GWENHYWFAR_BASE64_H 28 29 #include <gwenhywfar/gwenhywfarapi.h> 30 #include <gwenhywfar/buffer.h> 31 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 38 /** 39 * Encodes the given bytes and stores the result in a GWEN_BUFFER. 40 * @return 0 if ok, !=0 on error 41 * @param src src buffer 42 * @param size number of bytes in the source buffer 43 * @param dst destination buffer 44 * @param maxLineLength after this number of bytes a line break is inserted 45 * (if 0 then no line break is inserted) 46 */ 47 GWENHYWFAR_API 48 int GWEN_Base64_Encode(const unsigned char *src, unsigned int size, 49 GWEN_BUFFER *dst, 50 unsigned int maxLineLength); 51 52 /** 53 * Decodes base64 encoded data and stores the result in a GWEN_BUFFER. 54 * @return 0 if ok, !=0 on error 55 * @param src src buffer 56 * @param size number of bytes to store in the GWEN_BUFFER (this is NOT 57 * the number of bytes stored in the source buffer, that buffer must 58 * hold more bytes because base64 encoding inflates the data to 4/3). 59 * @param dst destination buffer 60 */ 61 GWENHYWFAR_API 62 int GWEN_Base64_Decode(const unsigned char *src, unsigned int size, 63 GWEN_BUFFER *dst); 64 65 #ifdef __cplusplus 66 } 67 #endif 68 69 #endif /* GWENHYWFAR_BASE64_H */ 70 71 72