xmlsecurityengine/xmlsec/inc/xmlsec_base64.h
changeset 0 e35f40988205
child 24 74f0b3eb154c
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 /** 
       
     2  * XML Security Library (http://www.aleksey.com/xmlsec).
       
     3  *
       
     4  * Base64 encode/decode transform and utility functions.
       
     5  *
       
     6  * This is free software; see Copyright file in the source
       
     7  * distribution for preciese wording.
       
     8  * 
       
     9  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey@aleksey.com>
       
    10  * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
       
    11  */
       
    12 #ifndef __XMLSEC_BASE64_H__
       
    13 #define __XMLSEC_BASE64_H__    
       
    14 
       
    15 #ifdef __cplusplus
       
    16 extern "C" {
       
    17 #endif /* __cplusplus */ 
       
    18 
       
    19 #include <libxml2_tree.h>
       
    20 #include "xmlsec_config.h"
       
    21 #include "xmlsec_xmlsec.h"
       
    22 #include "xmlsec_transforms.h"
       
    23 
       
    24 /**
       
    25  * XMLSEC_BASE64_LINESIZE:
       
    26  *
       
    27  * The default maximum base64 encoded line size.
       
    28  */
       
    29 #define XMLSEC_BASE64_LINESIZE				64
       
    30 
       
    31 /**
       
    32  * Base64 Context
       
    33  */
       
    34 typedef struct _xmlSecBase64Ctx 				xmlSecBase64Ctx, 
       
    35 								*xmlSecBase64CtxPtr;
       
    36 
       
    37 XMLSEC_EXPORT xmlSecBase64CtxPtr xmlSecBase64CtxCreate		(int encode, 
       
    38 								 int columns);
       
    39 XMLSEC_EXPORT void		xmlSecBase64CtxDestroy		(xmlSecBase64CtxPtr ctx);
       
    40 XMLSEC_EXPORT int		xmlSecBase64CtxInitialize	(xmlSecBase64CtxPtr ctx,
       
    41 								 int encode, 
       
    42 								 int columns);
       
    43 XMLSEC_EXPORT void		xmlSecBase64CtxFinalize		(xmlSecBase64CtxPtr ctx);
       
    44 XMLSEC_EXPORT int 		xmlSecBase64CtxUpdate		(xmlSecBase64CtxPtr ctx,
       
    45 								 const xmlSecByte *in, 
       
    46 						    		 xmlSecSize inSize, 
       
    47 								 xmlSecByte *out,
       
    48 								 xmlSecSize outSize);
       
    49 XMLSEC_EXPORT int		xmlSecBase64CtxFinal		(xmlSecBase64CtxPtr ctx,
       
    50 								 xmlSecByte *out,
       
    51 								 xmlSecSize outSize);
       
    52 
       
    53 /**
       
    54  * Standalone routine to do base64 encode/decode "at once"
       
    55  */
       
    56 XMLSEC_EXPORT xmlChar*		xmlSecBase64Encode		(const xmlSecByte *buf,
       
    57 								 xmlSecSize len,
       
    58 								 int columns);
       
    59 XMLSEC_EXPORT int		xmlSecBase64Decode		(const xmlChar* str,
       
    60 								 xmlSecByte *buf,
       
    61 								 xmlSecSize len);
       
    62 
       
    63 #ifdef __cplusplus
       
    64 }
       
    65 #endif /* __cplusplus */
       
    66 
       
    67 #endif /* __XMLSEC_BASE64_H__ */
       
    68