29 #ifndef ONLY_LOCAL_PROXY
35 const char*
const CAXMLPriceCert::ms_pStrElemName=
"PriceCertificate";
37 CAXMLPriceCert::CAXMLPriceCert()
39 m_StrSubjectKeyIdentifier = NULL;
40 m_StrSignatureTime = NULL;
45 CAXMLPriceCert::~CAXMLPriceCert()
47 delete[] m_StrSubjectKeyIdentifier;
48 m_StrSubjectKeyIdentifier = NULL;
50 delete[] m_StrSignatureTime;
51 m_StrSignatureTime = NULL;
56 if(m_domDocument != NULL)
60 m_domDocument->release();
65 CAXMLPriceCert* CAXMLPriceCert::getInstance(
const UINT8 * strXmlData,
UINT32 strXmlDataLen)
70 CAXMLPriceCert* pPC=
new CAXMLPriceCert();
80 CAXMLPriceCert* CAXMLPriceCert::getInstance(DOMElement* elemRoot)
84 CAMsg::printMsg(LOG_DEBUG,
"CAXMLPriceCert::getInstance: root element is null\n");
87 CAXMLPriceCert* pPC=
new CAXMLPriceCert();
89 pPC->m_domDocument->appendChild(pPC->m_domDocument->importNode(elemRoot,
true));
94 CAMsg::printMsg(LOG_DEBUG,
"CAXMLPriceCert::getInstance.setValues() FAILED \n");
99 SINT32 CAXMLPriceCert::toXmlElement(XERCES_CPP_NAMESPACE::DOMDocument* a_doc, DOMElement* &elemRoot)
105 DOMElement* elemHashOfMixCert =
createDOMElement(a_doc,
"SubjectKeyIdentifier");
107 elemRoot->appendChild(elemHashOfMixCert);
111 elemRoot->appendChild(elemRate);
115 elemRoot->appendChild(elemCreationTime);
119 elemRoot->appendChild(elemBiID);
122 if (m_signature != NULL)
124 elemRoot->appendChild(a_doc->importNode(m_signature,
true));
133 SINT32 CAXMLPriceCert::setValues()
137 if(m_domDocument==NULL)
142 DOMElement* elemRoot=m_domDocument->getDocumentElement();
143 DOMElement* elem=NULL;
145 if(!
equals(elemRoot->getTagName(),ms_pStrElemName))
147 CAMsg::printMsg(LOG_CRIT,
"Failed to get root elem tagname of price certificate!\n");
151 UINT8 strGeneral[512];
152 UINT32 strGeneralLen = 512;
154 delete[] m_StrSubjectKeyIdentifier;
155 m_StrSubjectKeyIdentifier=NULL;
160 m_StrSubjectKeyIdentifier =
new UINT8[strGeneralLen+1];
161 memcpy(m_StrSubjectKeyIdentifier, strGeneral,strGeneralLen+1);
166 delete[] m_StrSubjectKeyIdentifier;
167 m_StrSubjectKeyIdentifier=NULL;
168 CAMsg::printMsg(LOG_CRIT,
"Failed to parse subjectkeyidentifier of price certificate!\n");
176 CAMsg::printMsg(LOG_CRIT,
"Could not parse rate of price certificate!\n");
184 delete[] m_StrSignatureTime;
185 m_StrSignatureTime=NULL;
190 m_StrSignatureTime =
new UINT8[strGeneralLen+1];
191 memcpy(m_StrSignatureTime, strGeneral,strGeneralLen+1);
195 delete[] m_StrSignatureTime;
196 m_StrSignatureTime=NULL;
197 CAMsg::printMsg(LOG_CRIT,
"Could not parse SignatureTime of price certificate!\n");
201 UINT8 strGeneral2[512];
202 UINT32 strGeneralLen2 = 512;
210 m_StrBiID =
new UINT8[strGeneralLen2+1];
211 memcpy(m_StrBiID, strGeneral2,strGeneralLen2+1);
217 CAMsg::printMsg(LOG_CRIT,
"Could not parse parse BiID of price certificate!\n");
SINT32 setDOMElementAttribute(DOMNode *pElem, const char *attrName, const char *value)
SINT32 getDOMElementValue(const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
Returns the content of the text node(s) under elem as null-terminated C String.
SINT32 setDOMElementValue(DOMElement *pElem, SINT32 value)
bool equals(const XMLCh *const e1, const char *const e2)
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument(const UINT8 *const buff, UINT32 len)
Parses a buffer containing an XML document and returns this document.
XERCES_CPP_NAMESPACE::DOMDocument * createDOMDocument()
Parses a timestamp in JDBC timestamp escape format (as it comes from the BI) and outputs the value in...
DOMElement * createDOMElement(XERCES_CPP_NAMESPACE::DOMDocument *pOwnerDoc, const char *const name)
Creates a new DOMElement with the given name which belongs to the DOMDocument owernDoc.
SINT32 getDOMChildByName(const DOMNode *pNode, const char *const name, DOMElement *&child, bool deep)
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.