Mixe for Privacy and Anonymity in the Internet
CAXMLPriceCert.hpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000, The JAP-Team
00003 All rights reserved.
00004 Redistribution and use in source and binary forms, with or without modification,
00005 are permitted provided that the following conditions are met:
00006 
00007   - Redistributions of source code must retain the above copyright notice,
00008     this list of conditions and the following disclaimer.
00009 
00010   - Redistributions in binary form must reproduce the above copyright notice,
00011     this list of conditions and the following disclaimer in the documentation and/or
00012     other materials provided with the distribution.
00013 
00014   - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
00015     may be used to endorse or promote products derived from this software without specific
00016     prior written permission.
00017 
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00021 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00025 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00027 */
00028 #ifndef CAXMLPRICECERT_H_
00029 #define CAXMLPRICECERT_H_
00030 #ifdef PAYMENT
00031 #include "xml/DOM_Output.hpp"
00032 #include "CAAbstractXMLSignable.hpp"
00033 #include "CAMsg.hpp"
00041 class CAXMLPriceCert : public CAAbstractXMLSignable
00042 {
00043   public:
00048     static CAXMLPriceCert* getInstance(const UINT8 * strXmlData,UINT32 strXMLDataLength);
00049     
00050     static CAXMLPriceCert* getInstance(DOMElement* elemRoot);
00051     ~CAXMLPriceCert();
00052     
00053     SINT32 toXmlElement(XERCES_CPP_NAMESPACE::DOMDocument* a_doc, DOMElement* & elemRoot);
00054     
00056     UINT8* dumpToMem(UINT32* pLen)
00057       {
00058         if(m_domDocument==NULL)
00059           return NULL;
00060         return DOM_Output::dumpToMem(m_domDocument,pLen);
00061       }
00062 
00064     SINT32 toXMLString(UINT8* buff,UINT32* bufflen)
00065       {
00066         if(DOM_Output::dumpToMem(m_domDocument,buff,bufflen)!=E_SUCCESS)
00067           return E_UNKNOWN;
00068         buff[*bufflen]=0;
00069         return E_SUCCESS;
00070       }
00071 
00075     UINT8 * getSubjectKeyIdentifier()
00076     {
00077       UINT8* pTmpStr = NULL;
00078       if(m_StrSubjectKeyIdentifier!=NULL)
00079         {
00080           pTmpStr = new UINT8[strlen((char*)m_StrSubjectKeyIdentifier)+1];
00081           strcpy((char*)pTmpStr, (char*)m_StrSubjectKeyIdentifier);
00082         }
00083       return pTmpStr; 
00084       
00085     } 
00086     
00087     double getRate()
00088     {
00089       return m_lRate;
00090     }
00091     
00095     UINT8* getSignatureTime()
00096     {
00097       UINT8* pTmpStr = NULL;
00098       if(m_StrSignatureTime!=NULL)
00099         {
00100           pTmpStr = new UINT8[strlen((char*)m_StrSignatureTime)+1];
00101           strcpy((char*)pTmpStr, (char*)m_StrSignatureTime);
00102         }
00103       return pTmpStr;       
00104     }
00105     
00109     UINT8* getBiID()
00110     {
00111       UINT8* pTmpStr = NULL;
00112       if(m_StrBiID!=NULL)
00113         {
00114           pTmpStr = new UINT8[strlen((char*)m_StrBiID)+1];
00115           strcpy((char*)pTmpStr, (char*)m_StrBiID);
00116         }
00117       return pTmpStr; 
00118     }
00119     
00120     static const char* const getXMLElementName()
00121     {
00122       return ms_pStrElemName;
00123     }
00124   
00125      XERCES_CPP_NAMESPACE::DOMDocument* getXMLDocument()
00126     {
00127       return m_domDocument;
00128     }
00129     
00130     
00131     
00132     
00133   private:
00134     CAXMLPriceCert();
00135     SINT32 setValues();
00136     
00137     UINT8*    m_StrSubjectKeyIdentifier;
00138     double    m_lRate;
00139     UINT8*    m_StrSignatureTime;
00140     UINT8*    m_StrBiID;
00141     DOMElement*  m_signature;
00142      XERCES_CPP_NAMESPACE::DOMDocument* m_domDocument;
00143     static const char* const ms_pStrElemName;
00144         
00145 };
00146 
00147 #endif //PAYMENT
00148 #endif /*CAXMLPRICECERT_H_*/