00001 /* 00002 * Copyright 2002-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 * TXFMBase64 := Class that performs a Base64 transforms 00021 * 00022 * $Id: TXFMBase64.hpp,v 1.11 2005/02/03 13:50:12 milan Exp $ 00023 * 00024 */ 00025 00026 // XSEC Includes 00027 00028 #include <xsec/transformers/TXFMBase.hpp> 00029 #include <xsec/enc/XSECCryptoBase64.hpp> 00030 00036 class DSIG_EXPORT TXFMBase64 : public TXFMBase { 00037 00038 public: 00039 00040 // Constructors and destructors 00041 00042 TXFMBase64(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, bool decode = true); 00043 ~TXFMBase64(); 00044 00045 // Methods to get tranform output type and input requirement 00046 00047 virtual TXFMBase::ioType getInputType(void); 00048 virtual TXFMBase::ioType getOutputType(void); 00049 virtual nodeType getNodeType(void); 00050 00051 // Methods to set input data 00052 00053 virtual void setInput(TXFMBase * newInput); 00054 00055 // Methods to get output data 00056 00057 virtual unsigned int readBytes(XMLByte * const toFill, const unsigned int maxToFill); 00058 virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getDocument(); 00059 virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getFragmentNode(); 00060 virtual const XMLCh * getFragmentId(); 00061 00062 private: 00063 TXFMBase64(); 00064 00065 bool m_complete; // Is the work done 00066 unsigned char m_outputBuffer[2050]; // Always keep 2K of data 00067 unsigned char m_inputBuffer[1026]; // Always read 1026 bytes (encoding grows) 00068 unsigned int m_remaining; // How much data is left in the buffer? 00069 XSECCryptoBase64 * mp_b64; 00070 bool m_doDecode; // Are we encoding or decoding? 00071 }; 00072