vpnengine/utlbase64/inc/base64.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Base64 encoder/decoder
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _BASE64_H_
       
    21 #define _BASE64_H_
       
    22 
       
    23 #define B64_NOP_CHR '='
       
    24 #define B64_LINEBREAK '\n'
       
    25 #define B64_NOP_VAL 254
       
    26 #define B64_IGN 255
       
    27 #define MAXLINELEN 76
       
    28 
       
    29 // encoding table
       
    30 static const TUint8 Kb64 [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
       
    31 
       
    32 class TBase64Codec
       
    33 {
       
    34 	public:
       
    35 		// Public interface
       
    36 		IMPORT_C TInt Base64Encode(const TDesC8 &aRawData, const TDes8 &aEncodedData);
       
    37 		IMPORT_C TInt Base64Decode(const TDesC8 &aEncodedData, const TDes8 &aDecodedData);
       
    38 		IMPORT_C HBufC8* Base64EncodeLC(const TDesC8 &aRawData);
       
    39 		IMPORT_C HBufC8* Base64DecodeLC(const TDesC8 &aEncodedData);
       
    40 		IMPORT_C TBase64Codec();
       
    41 
       
    42 	private:	
       
    43 		TUint8 iD64[256]; /* decoding table */
       
    44 		void InitBase64(void);
       
    45 };
       
    46 
       
    47 #endif
       
    48