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

TXFMCipher.hpp

Go to the documentation of this file.
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  * TXFMCipher := Class that performs a symmetric encrypt/decrypt transform
00021  *
00022  * $Id: TXFMCipher.hpp,v 1.4 2005/02/03 13:50:12 milan Exp $
00023  *
00024  */
00025 
00026 #ifndef TXFMCIPHER_INCLUDE
00027 #define TXFMCIPHER_INCLUDE
00028 
00029 // XSEC Includes
00030 
00031 #include <xsec/transformers/TXFMBase.hpp>
00032 #include <xsec/enc/XSECCryptoSymmetricKey.hpp>
00033  
00042 class DSIG_EXPORT TXFMCipher : public TXFMBase {
00043 
00044 public:
00045 
00046     // Constructors and destructors
00047 
00048     TXFMCipher(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XSECCryptoKey * key, bool encrypt);
00049     ~TXFMCipher();
00050 
00051     // Methods to get tranform output type and input requirement
00052 
00053     virtual TXFMBase::ioType getInputType(void);
00054     virtual TXFMBase::ioType getOutputType(void);
00055     virtual nodeType getNodeType(void);
00056 
00057     // TXFMCipher Unique
00058 
00059     void setKey(unsigned char * key, unsigned int keyLen);
00060 
00061     // Methods to set input data
00062 
00063     virtual void setInput(TXFMBase * newInput);
00064 
00065     // Methods to get output data
00066 
00067     virtual unsigned int readBytes(XMLByte * const toFill, const unsigned int maxToFill);
00068     virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getDocument();
00069     virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getFragmentNode();
00070     virtual const XMLCh * getFragmentId();
00071     
00072 private:
00073     TXFMCipher();
00074 
00075     bool                    m_doEncrypt;        // Are we in encrypt (or decrypt) mode
00076     XSECCryptoKey           * mp_cipher;        // Crypto implementation
00077     bool                    m_complete;
00078     unsigned char           m_inputBuffer[2050];
00079     unsigned char           m_outputBuffer[3072];   // Always keep 2K of data
00080     unsigned int            m_remaining;        // Amount remaining in output
00081 
00082 };
00083 
00084 #endif /* TXFMCIPHER_INCLUDE */
00085 

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