Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

XSCryptCryptoBase64.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2003-2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * XSCryptCryptoBase64 := Internal implementation of a base64 encoder/decoder
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: XSCryptCryptoBase64.hpp,v 1.6 2005/02/03 13:21:27 milan Exp $
00025  *
00026  */
00027 
00028 #ifndef XSCRYPTCRYPTOBASE64_INCLUDE
00029 #define XSCRYPTCRYPTOBASE64_INCLUDE
00030 
00031 #include <xsec/framework/XSECDefs.hpp>
00032 #include <xsec/enc/XSECCryptoBase64.hpp>
00033 #include <xsec/utils/XSECSafeBuffer.hpp>
00034 
00046 class DSIG_EXPORT XSCryptCryptoBase64 : public XSECCryptoBase64 {
00047 
00048 
00049 public :
00050 
00051     // Constructors/Destructors
00052     
00053     XSCryptCryptoBase64() : m_state(B64_UNINITIALISED) {};
00054     virtual ~XSCryptCryptoBase64() {};
00055 
00058 
00067     virtual void         decodeInit(void);                  // Setup
00068 
00082     virtual unsigned int decode(const unsigned char * inData, 
00083                                 unsigned int inLength,
00084                                 unsigned char * outData,
00085                                 unsigned int outLength);
00086 
00098     virtual unsigned int decodeFinish(unsigned char * outData,
00099                                       unsigned int outLength);
00100 
00102 
00105 
00113     virtual void         encodeInit(void);
00114 
00126     virtual unsigned int encode(const unsigned char * inData, 
00127                                 unsigned int inLength,
00128                                 unsigned char * outData,
00129                                 unsigned int outLength);
00130 
00143     virtual unsigned int encodeFinish(unsigned char * outData,
00144                                       unsigned int outLength);
00145 
00147 
00148 private :
00149 
00150     enum b64state {
00151 
00152         B64_UNINITIALISED,
00153         B64_ENCODE,
00154         B64_DECODE,
00155     };
00156 
00157     safeBuffer              m_inputBuffer;      // Carry over buffer
00158     safeBuffer              m_outputBuffer;     // Carry over output
00159 
00160     unsigned int            m_remainingInput;   // Number of bytes in carry input buffer
00161     unsigned int            m_remainingOutput;  // Number of bytes in carry output buffer
00162 
00163     bool                    m_allDone;          // End found (=)
00164 
00165     b64state                m_state;            // What are we currently doing?
00166 
00167     unsigned int            m_charCount;        // How many characters in current line?
00168 
00169     // Private functions
00170     void canonicaliseInput(const unsigned char *inData, unsigned int inLength);
00171 
00172 };
00173 
00174 #endif /* XSCRYPTCRYPTOBASE64_INCLUDE */

Generated on Sun Jul 3 17:37:27 2005 for XML-Security-C by  doxygen 1.4.2