36 char* internal_sbrk_start=(
char*)sbrk(0);
53 UINT32 end=strlen((
char*)s);
59 while(start<=end&&s[start]<=32)
66 while(end>start&&s[end]<=32)
69 memmove(s,s+start,size);
77 int ii = strlen((
char*)a_string);
78 for (
int i=0; i <ii;i++)
81 if (ch>=
'A' && ch<=
'Z')
92 if(bytes==NULL||
len==0)
128 if(src==NULL||size==0)
134 while(start<=end&&src[start]<=32)
138 while(end>start&&src[end]<=32)
141 memmove(dest,src+start,size);
150 if(src==NULL||ins==NULL)
152 UINT32 srcLen=strlen(src);
155 UINT32 insLen=strlen(ins);
156 char* newString=
new char[srcLen+insLen+1];
159 memcpy(newString,src,pos);
160 memcpy(newString+pos,ins,insLen);
161 memcpy(newString+pos+insLen,src+pos,srcLen-pos+1);
168 char*
strins(
const char* src,
const char * pos,
const char* ins)
170 if(pos==NULL||pos<src)
172 return strins(src,pos-src,ins);
175 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_LAST_MIX
180 CAMsg::printMsg(LOG_DEBUG,
"Memory consumption reported by sbrk(): %u\n",(
long)((
char*)sbrk(0)-internal_sbrk_start));
183 struct mallinfo malli=mallinfo();
185 CAMsg::printMsg(LOG_DEBUG,
"Memory consumption reported by mallinfo():\n");
186 CAMsg::printMsg(LOG_DEBUG,
"\t Total size of memory allocated with sbrk() by malloc() [bytes]: %i\n",malli.arena);
187 CAMsg::printMsg(LOG_DEBUG,
"\t Number of chunks not in use: %i\n",malli.ordblks);
188 CAMsg::printMsg(LOG_DEBUG,
"\t Total number of chunks allocated with mmap(): %i\n",malli.hblks);
189 CAMsg::printMsg(LOG_DEBUG,
"\t Total size of memory allocated with mmap() [byte]: %i\n",malli.hblkhd);
190 CAMsg::printMsg(LOG_DEBUG,
"\t Total size of memory occupied by chunks handed out by malloc(): %i\n",malli.uordblks);
191 CAMsg::printMsg(LOG_DEBUG,
"\t Total size of memory occupied by free (not in use) chunks: %i\n",malli.fordblks);
192 CAMsg::printMsg(LOG_DEBUG,
"\t Size of the top-most releasable chunk that normally borders the end of the heap: %i\n",malli.keepcost);
233 t.tv_sec=timebuffer.time;
234 t.tv_nsec=timebuffer.millitm*1000000;
240 gettimeofday(&tv,NULL);
242 t.tv_nsec=tv.tv_usec*1000;
258 u64Time=((
UINT64)timebuffer.time)*1000+((
UINT64)timebuffer.millitm);
264 gettimeofday(&tv,NULL);
265 #ifdef HAVE_NATIVE_UINT64
266 u64Time=((
UINT64)tv.tv_sec)*1000+((
UINT64)tv.tv_usec)/1000;
286 u64Time=((
UINT64)timebuffer.time)*1000000+((
UINT64)timebuffer.millitm)*1000;
292 gettimeofday(&tv,NULL);
293 #ifdef HAVE_NATIVE_UINT64
294 u64Time=((
UINT64)tv.tv_sec)*1000000+((
UINT64)tv.tv_usec);
308 unsigned char randbuff[255];
310 RAND_seed(randbuff,
sizeof(randbuff));
326 if(date1->tm_year != date2->tm_year)
328 return (date1->tm_year < date2->tm_year) ? -1 : 1;
330 if(date1->tm_mon != date2->tm_mon)
332 return (date1->tm_mon < date2->tm_mon) ? -1 : 1;
334 if(date1->tm_mday != date2->tm_mday)
336 return (date1->tm_mday < date2->tm_mday) ? -1 : 1;
348 ASSERT(val!=NULL,
"VAL should be not NULL");
349 if(RAND_bytes((
UINT8*)val,4)!=1
350 #
if OPENSSL_VERSION_NUMBER <0x10100000L
351 && RAND_pseudo_bytes((
UINT8*)val,4)<0
365 ASSERT(val != NULL,
"VAL should be not NULL");
366 if (RAND_bytes((
UINT8*)val, 2) != 1
367 #
if OPENSSL_VERSION_NUMBER <0x10100000L
368 && RAND_pseudo_bytes((
UINT8*)val, 4) < 0
377 ASSERT(val!=NULL,
"VAL should be not NULL");
379 #
if OPENSSL_VERSION_NUMBER <0x10100000L
395 ASSERT(buff!=NULL,
"BUFF should be not NULL")
396 if(RAND_bytes(buff,
len)!=1
397 #
if OPENSSL_VERSION_NUMBER <0x10100000L
398 && RAND_pseudo_bytes(buff,
len)<0
414 req.tv_nsec=(ms%1000)*1000000;
415 while(nanosleep(&req,&rem)==-1)
417 req.tv_sec=rem.tv_sec;
418 req.tv_nsec=rem.tv_nsec;
434 while(nanosleep(&req,&rem)==-1)
436 req.tv_sec=rem.tv_sec;
437 req.tv_nsec=rem.tv_nsec;
446 struct rusage usage_self;
447 if(getrusage(RUSAGE_SELF,&usage_self)==-1)
449 struct rusage usage_children;
450 if(getrusage(RUSAGE_CHILDREN,&usage_children)==-1)
452 return usage_self.ru_idrss+usage_children.ru_idrss;
467 DOMNode *pChild=pNode->getFirstChild();
480 pChild=pChild->getNextSibling();
490 XMLCh* tmpName=XMLString::transcode((
const char *
const)name);
492 XMLString::release(&tmpName);
503 DOMNode* child = parent->getFirstChild();
512 signatureNodes[count] = child;
520 child = child->getNextSibling();
532 #if !defined ONLY_LOCAL_PROXY && defined PAYMENT
535 if( (srcNode->getNodeType() != DOMNode::ELEMENT_NODE) ||
536 (dstNode->getNodeType() != DOMNode::ELEMENT_NODE) )
541 DOMNodeList *srcList = srcNode->getChildNodes();
542 XERCES_CPP_NAMESPACE::DOMDocument *srcOwnerDoc = srcNode->getOwnerDocument();
543 XERCES_CPP_NAMESPACE::DOMDocument *dstOwnerDoc = dstNode->getOwnerDocument();
546 #if _XERCES_VERSION >= 30001
547 srcNode->compareDocumentPosition(dstNode);
549 srcNode->compareTreePosition(dstNode);
553 CAMsg::printMsg(LOG_ERR,
"integrate impossible due to illegal tree positions, (pos: 0x%x)\n", pos);
557 if(srcList->getLength() == 0)
562 DOMElement *srcElem = (DOMElement *) srcNode;
563 DOMElement *dstElem = (DOMElement *) dstNode;
565 DOMNode *currSrcChild = NULL;
566 XMLCh** nodeNames=
new XMLCh*[srcList->getLength()];
567 memset(nodeNames,0,
sizeof(XMLCh*)*srcList->getLength());
568 UINT32 nodeNamesIndex = 0;
569 XMLCh *currSrcChildName = NULL;
571 DOMNodeList *currSrcChildren = NULL;
572 DOMNodeList *currDstChildren = NULL;
573 bool nodeAlreadyFinished =
false;
575 for(XMLSize_t i = 0; i < srcList->getLength(); i++)
577 currSrcChild = srcList->item(i);
578 if( currSrcChild->getNodeType() == DOMNode::ELEMENT_NODE )
580 nodeAlreadyFinished =
false;
581 currSrcChildName = (XMLCh *) ((DOMElement *) currSrcChild)->getTagName();
585 for(
UINT32 j = 0; j < nodeNamesIndex; j++ )
589 nodeAlreadyFinished =
true;
594 if(nodeAlreadyFinished)
598 currDstChildren = dstElem->getElementsByTagName(currSrcChildName);
599 currSrcChildren = srcElem->getElementsByTagName(currSrcChildName);
602 j < currSrcChildren->getLength(); j++ )
604 if(j >= currDstChildren->getLength())
606 if( (dstOwnerDoc != NULL) && (srcOwnerDoc != dstOwnerDoc) )
608 dstNode->appendChild(dstOwnerDoc->importNode(currSrcChildren->item(j),
true));
612 dstNode->appendChild(currSrcChildren->item(j)->cloneNode(
true));
617 if( (dstOwnerDoc != NULL) && (srcOwnerDoc != dstOwnerDoc) )
619 dstElem->replaceChild(dstOwnerDoc->importNode(currSrcChildren->item(j),
true),currDstChildren->item(j));
625 dstElem->replaceChild(dstOwnerDoc->cloneNode(currSrcChildren->item(j)),currDstChildren->item(j));
631 if(currSrcChildren->item(j)->hasChildNodes() )
633 integrateDOMNode(currSrcChildren->item(j), currDstChildren->item(j),
true,
false);
636 nodeNames[nodeNamesIndex++] = currSrcChildName;
645 bool equals(
const XMLCh*
const e1,
const char*
const e2)
647 XMLCh* e3=XMLString::transcode(e2);
649 XMLString::release(&e3);
666 MemBufInputSource in(buff,
len,
"tmpBuff");
668 XERCES_CPP_NAMESPACE::DOMDocument* ret=NULL;
678 #if !defined ONLY_LOCAL_PROXY && defined PAYMENT
684 XERCES_CPP_NAMESPACE::DOMDocument* ret=NULL;
709 ASSERT(value!=NULL,
"Value is null");
710 ASSERT(valuelen!=NULL,
"ValueLen is null");
711 ASSERT(pElem!=NULL,
"Element is NULL");
715 UINT32 spaceLeft=*valuelen;
717 const XMLCh* str=pElem->getNodeName();
718 char* tmpStr=XMLString::transcode(str);
719 UINT32 tmpStrLen=strlen(tmpStr);
720 if(tmpStrLen>=spaceLeft)
722 *valuelen=tmpStrLen+1;
723 XMLString::release(&tmpStr);
726 memcpy(value+(*valuelen),tmpStr,tmpStrLen);
727 *valuelen+=tmpStrLen;
728 XMLString::release(&tmpStr);
729 value[*valuelen] = 0;
748 ASSERT(value!=NULL,
"Value is null");
749 ASSERT(valuelen!=NULL,
"ValueLen is null");
750 ASSERT(pElem!=NULL,
"Element is NULL");
753 DOMNode* pText=pElem->getFirstChild();
754 UINT32 spaceLeft=*valuelen;
758 if(pText->getNodeType()==DOMNode::TEXT_NODE)
760 const XMLCh* str=pText->getNodeValue();
761 char* tmpStr=XMLString::transcode(str);
762 UINT32 tmpStrLen=strlen(tmpStr);
763 if(tmpStrLen>=spaceLeft)
765 *valuelen=tmpStrLen+1;
766 XMLString::release(&tmpStr);
769 memcpy(value+(*valuelen),tmpStr,tmpStrLen);
770 *valuelen+=tmpStrLen;
771 spaceLeft-=tmpStrLen;
772 XMLString::release(&tmpStr);
774 pText=pText->getNextSibling();
782 if(elem==NULL||attrName==NULL||value==NULL||
len==NULL||elem->getNodeType()!=DOMNode::ELEMENT_NODE)
784 XMLCh* name=XMLString::transcode(attrName);
785 const XMLCh* tmpCh=((DOMElement*)elem)->getAttribute(name);
786 XMLString::release(&name);
787 char* tmpStr=XMLString::transcode(tmpCh);
795 XMLString::release(&tmpStr);
799 memcpy(value,tmpStr,l+1);
800 XMLString::release(&tmpStr);
810 *value=atol((
char*)val);
814 DOMElement*
createDOMElement(XERCES_CPP_NAMESPACE::DOMDocument* pOwnerDoc,
const char *
const name)
816 XMLCh* n=XMLString::transcode(name);
817 DOMElement* ret=pOwnerDoc->createElement(n);
818 XMLString::release(&n);
822 DOMText*
createDOMText(XERCES_CPP_NAMESPACE::DOMDocument* pOwnerDoc,
const char *
const text)
824 XMLCh* t=XMLString::transcode(text);
825 DOMText* ret= pOwnerDoc->createTextNode(t);
826 XMLString::release(&t);
838 if(pElem==NULL||pElem->getNodeType()!=DOMNode::ELEMENT_NODE||attrName==NULL||value==NULL)
840 XMLCh* name=XMLString::transcode(attrName);
841 XMLCh* val=XMLString::transcode((
const char*)value);
842 ((DOMElement*)pElem)->setAttribute(name,val);
843 XMLString::release(&name);
844 XMLString::release(&val);
850 if( pElem == NULL || pElem->getNodeType() != DOMNode::ELEMENT_NODE )
856 UINT8 tmpStrCurrentMillis[50];
857 print64(tmpStrCurrentMillis,currentMillis);
892 if( (tmpTypeLen == 0) ||
893 (tmpLocaleLen == 0) ||
899 size_t templateRefIdLen = tmpTypeLen+tmpLocaleLen+tmpDateLen+2;
901 char *templateRefId =
new char[templateRefIdLen+1];
902 memset(templateRefId, 0, templateRefIdLen+1);
903 snprintf(templateRefId, templateRefIdLen+1,
"%s_%s_%s", (
char *) tmpType, (
char *) tmpLocale, (
char *) tmpDate);
905 return (
UINT8 *) templateRefId;
922 ASSERT(value!=NULL,
"Value is null");
923 ASSERT(pElem!=NULL,
"Element is NULL");
928 *value=atol((
char*)buff);
935 #ifndef ONLY_LOCAL_PROXY
944 snprintf((
char*)tmp, 11,
"%d", value);
952 snprintf(tmp,400,
"%.2f", floatValue);
984 snprintf((
char *) tmp, 50,
"%lld", value);
991 sprintf((
char*)tmp,
"%i", value);
1010 ASSERT(value!=NULL,
"Value is null");
1011 ASSERT(pElem!=NULL,
"Element is NULL");
1016 *value=atol((
char*)buff);
1023 ASSERT(value!=NULL,
"Value is null");
1024 ASSERT(pElem!=NULL,
"Element is NULL");
1029 *value=atof((
char*)buff);
1036 ASSERT(pElem!=NULL,
"Element is NULL");
1053 ASSERT(pElem!=NULL,
"Element is NULL");
1088 XERCES_CPP_NAMESPACE::DOMDocument* doc=NULL;
1089 DOMNode* parent=NULL;
1090 if(node->getNodeType()==DOMNode::DOCUMENT_NODE)
1092 doc=(XERCES_CPP_NAMESPACE::DOMDocument*)node;
1094 node=doc->getDocumentElement();
1098 doc=node->getOwnerDocument();
1099 parent=node->getParentNode();
1103 elemRoot->appendChild(elemKeyInfo);
1105 elemKeyInfo->appendChild(elemEncKey);
1107 elemEncKey->appendChild(elemCipherData);
1109 elemCipherData->appendChild(elemCipherValue);
1118 pOutBuff[outbufflen]=0;
1125 pSymCipher->
setKey(key,
true);
1126 pSymCipher->
setIV(key+16);
1128 elemRoot->appendChild(elemCipherData);
1130 elemCipherData->appendChild(elemCipherValue);
1132 outbufflen=bufflen+1000;
1133 pOutBuff=
new UINT8[outbufflen];
1137 bufflen=outbufflen*3/2+1000;
1138 pBuff=
new UINT8[bufflen];
1146 if(parent->getNodeType()==DOMNode::DOCUMENT_NODE)
1148 DOMNode* n=parent->removeChild(node);
1154 parent->appendChild(elemRoot);
1158 DOMNode* n=parent->replaceChild(elemRoot,node);
1190 const char* XML_ENC_TEMPLATE=
"<EncryptedData><ds:KeyInfo><EncryptedKey><CipherData><CipherValue>%s</CipherValue></CipherData></EncryptedKey></ds:KeyInfo><CipherData><CipherValue>%s</CipherValue></CipherData></EncryptedData>";
1196 UINT8 keyoutbuff[1000];
1197 UINT32 keyoutbufflen=255;
1199 keyoutbuff[keyoutbufflen]=0;
1201 pSymCipher->
setKey(key,
true);
1202 pSymCipher->
setIV(key+16);
1203 UINT32 msgoutbufflen=inlen+1000;
1208 UINT32 encmsgoutbufflen=msgoutbufflen*3/2+1000;
1209 UINT8* encmsgoutbuff=
new UINT8[encmsgoutbufflen];
1210 CABase64::encode(msgoutbuff,msgoutbufflen,encmsgoutbuff,&encmsgoutbufflen);
1211 delete[] msgoutbuff;
1213 encmsgoutbuff[encmsgoutbufflen]=0;
1214 msgoutbufflen=encmsgoutbufflen+1000;
1215 msgoutbuff=
new UINT8[msgoutbufflen];
1216 sprintf((
char*)msgoutbuff,XML_ENC_TEMPLATE,keyoutbuff,encmsgoutbuff);
1217 outlen=strlen((
char*)msgoutbuff);
1218 delete[] encmsgoutbuff;
1219 encmsgoutbuff = NULL;
1223 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
1226 XERCES_CPP_NAMESPACE::DOMDocument* doc=node->getOwnerDocument();
1227 if(!
equals(node->getNodeName(),
"EncryptedData"))
1229 DOMNode* elemKeyInfo=NULL;
1231 DOMNode* elemEncKey=NULL;
1233 DOMNode* elemCipherValue=NULL;
1239 delete[] cipherValue;
1247 delete[] cipherValue;
1252 pSymCipher->
setKey(cipherValue,
false);
1253 pSymCipher->
setIV(cipherValue+16);
1255 DOMNode* elemCipherData=NULL;
1263 delete[] cipherValue;
1271 delete[] cipherValue;
1280 delete[] cipherValue;
1286 delete[] cipherValue;
1288 DOMNode* elemPlainRoot=NULL;
1291 if((elemPlainRoot=docPlain->getDocumentElement())==NULL)
1293 if (docPlain != NULL)
1295 docPlain->release();
1300 elemPlainRoot=doc->importNode(elemPlainRoot,
true);
1301 DOMNode* parent=node->getParentNode();
1302 if(parent->getNodeType()==DOMNode::DOCUMENT_NODE)
1304 DOMNode* n=parent->removeChild(node);
1310 parent->appendChild(elemPlainRoot);
1314 DOMNode* n=parent->replaceChild(elemPlainRoot,node);
1321 if (docPlain != NULL)
1323 docPlain->release();
1332 int handle=open((
char*)name,
O_BINARY|O_RDONLY);
1342 if (read(handle, buff, *size) != *size)
1369 UINT16 v = atol((
const char*)str);
1380 #ifdef HAVE_STRTOULL
1382 if(strchr((
const char*)str,
'-')!=NULL)
1386 char *endptr = NULL;
1387 value = strtoull((
const char *) str, &endptr, 0);
1388 if(endptr!=NULL&&*endptr==0)
1392 #ifdef HAVE_NATIVE_UINT64
1406 if (c >=
'0' && c <=
'9')
1411 else if (i != 0 || str[i] !=
'+')
1419 #warning parseU64() is not implemented for platforms without native UINT64 support!!!
1433 value = atoll((
const char *) str);
1436 #ifdef HAVE_NATIVE_UINT64
1450 if (c >=
'0' && c <=
'9')
1455 else if (i != 0 || str[i] !=
'+'||str[i]!=
'-')
1466 #warning parseS64() is not implemented for platforms without native INT64 support!!!
1482 if(tcgetattr(STDIN_FILENO,&tmpTermios)!=0)
1486 flags=tmpTermios.c_lflag;
1487 tmpTermios.c_lflag&=~(ECHO);
1489 tcsetattr(STDIN_FILENO,TCSAFLUSH,&tmpTermios);
1493 for(i=0;i<
len-1;i++)
1500 if(c<=0||c==
'\r'||c==
'\n')
1507 tmpTermios.c_lflag=
flags;
1509 tcsetattr(STDIN_FILENO,TCSAFLUSH,&tmpTermios);
1567 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
1570 DOMImplementation* pImpl=DOMImplementation::getImplementation();
1571 return pImpl->createDocument();
1578 snprintf((
char*)tmp, 10,
"%u", value);
1584 XMLCh* val=XMLString::transcode((
const char *)value);
1585 DOMText* pText=pElem->getOwnerDocument()->createTextNode(val);
1586 XMLString::release(&val);
1588 DOMNode* pChild=pElem->getFirstChild();
1591 if(pChild->getNodeType()==DOMNode::TEXT_NODE)
1593 DOMNode* n=pElem->removeChild(pChild);
1600 pChild=pChild->getNextSibling();
1602 pElem->appendChild(pText);
1609 sprintf((
char*)tmp,
"%u", value);
1619 long l=atol((
char*)val);
1632 DOMElement* root=pDoc->getDocumentElement();
1648 DOMNode* elemCipherValue=NULL;
1657 for(
SINT32 i=127;i>=0;i--)
1669 memcpy(key,buff+128-(*keylen),(*keylen));
1675 UINT8 tmpBuff[1024];
1676 memset(tmpBuff,0,
sizeof(tmpBuff));
1677 memcpy(tmpBuff+128-keylen,key,keylen);
1678 pRSA->
encrypt(tmpBuff,tmpBuff);
1685 #define XML_ENCODE_KEY_TEMPLATE "<EncryptedKey><EncryptionMethod Algorithm=\"RSA\"/><CipherData><CipherValue>%s</CipherValue></CipherData></EncryptedKey>"
1686 UINT8 tmpBuff[1024];
1690 *xmllen=strlen((
char*)xml);
1699 elemRootEncodedKey->appendChild(elem1);
1701 elem1->appendChild(elem2);
1703 elem2->appendChild(elem1);
1704 UINT8 tmpBuff[1024];
1713 XMLCh* tmpCh=XMLString::transcode(name);
1714 DOMNodeList* ret=pElem->getElementsByTagName(tmpCh);
1715 XMLString::release(&tmpCh);
1729 XMLCh* tmpName=XMLString::transcode((
const char *
const)name);
1731 XMLString::release(&tmpName);
1743 pChild=pNode->getLastChild();
1751 pChild=pChild->getPreviousSibling();
1823 if (bytespersecond < 1000)
1825 snprintf((
char*)buff, buffsize,
"%llu Bytes/s", bytespersecond);
1827 else if (bytespersecond < 1000000)
1829 snprintf((
char*)buff, buffsize,
"%.2f KBytes/s", bytespersecond/1000.0);
1832 else if (bytespersecond < 1000000000)
1834 snprintf((
char*)buff, buffsize,
"%.2f MBytes/s", bytespersecond/1000000.0);
1839 snprintf((
char*)buff, buffsize,
"%.2f GBytes/s", bytespersecond/1000000000.0);
SINT32 getNodeName(const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
SINT32 setDOMElementAttribute(DOMNode *pElem, const char *attrName, const char *value)
UINT8 * bytes2hex(const void *bytes, UINT32 len)
Converts the byte array to a hex string.
SINT32 getcurrentTimeMillis(UINT64 &u64Time)
Gets the current Systemtime in milli seconds.
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.
UINT8 * readFile(const UINT8 *const name, UINT32 *size)
ONLY_LOCAL_PROXY or first.
SINT32 setDOMElementValue(DOMElement *pElem, SINT32 value)
SINT32 setCurrentTimeMilliesAsDOMAttribute(DOMNode *pElem)
SINT32 readPasswd(UINT8 *buff, UINT32 len)
Read a passwd (i.e.
char * strins(const char *src, UINT32 pos, const char *ins)
Inserts a String ins in a String src starting after pos chars.
SINT32 getcurrentTimeMicros(UINT64 &u64Time)
Gets the current Systemtime in micros seconds.
UINT32 strtrim(UINT8 *s)
Removes leading and ending whitespaces (chars<=32) from a zero terminated string.
XercesDOMParser * theDOMParser
SINT32 parseS64(const UINT8 *str, SINT64 &value)
Parses a 64bit signed integer.
bool equals(const XMLCh *const e1, const char *const e2)
SINT32 sSleep(UINT32 sec)
Sleeps sec Seconds.
UINT8 * getTermsAndConditionsTemplateRefId(DOMNode *tcTemplateRoot)
void __encryptKey(UINT8 *key, UINT32 keylen, UINT8 *outBuff, UINT32 *outLen, CAASymCipher *pRSA)
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument(const UINT8 *const buff, UINT32 len)
Parses a buffer containing an XML document and returns this document.
DOMNodeList * getElementsByTagName(DOMElement *pElem, const char *const name)
SINT32 parseU64(const UINT8 *str, UINT64 &value)
Parses a 64bit unsigned integer.
SINT32 getRandom(UINT32 *val)
Gets 32 random bits.
DOMText * createDOMText(XERCES_CPP_NAMESPACE::DOMDocument *pOwnerDoc, const char *const text)
Creates a new DOMText with the given value which belongs to the DOMDocument owernDoc.
SINT32 decryptXMLElement(DOMNode *node, CAASymCipher *pRSA)
Replaces a DOM element with a deencrypted version of this element.
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)
SINT32 getcurrentTime(timespec &t)
Gets the current Systemtime in milli seconds.
CAMutex * theParseDOMDocumentLock
UINT32 toLower(UINT8 *a_string)
void formatBytesPerSecond(UINT8 *buff, UINT32 buffsize, UINT64 bytespersecond)
SINT32 getDOMElementAttribute(const DOMNode *const elem, const char *attrName, UINT8 *value, UINT32 *len)
void logMemoryUsage()
Log information about the current memory (heap) usage.
SINT32 saveFile(const UINT8 *const name, const UINT8 *const buff, UINT32 buffSize)
SINT32 encodeXMLEncryptedKey(UINT8 *key, UINT32 keylen, UINT8 *xml, UINT32 *xmllen, CAASymCipher *pRSA)
SINT32 getLastDOMChildByName(const DOMNode *pNode, const char *const name, DOMElement *&a_child)
SINT32 memtrim(UINT8 *dest, const UINT8 *src, UINT32 size)
Removes leading and ending whitespaces (chars<=32) from a byte array.
SINT32 encryptXMLElement(DOMNode *node, CAASymCipher *pRSA)
The resulting encrypted xml struct is as follows:
SINT32 decodeXMLEncryptedKey(UINT8 *key, UINT32 *keylen, const UINT8 *const xml, UINT32 xmllen, CAASymCipher *pRSA)
SINT32 getSignatureElements(DOMNode *parent, DOMNode **signatureNodes, UINT32 *length)
SINT32 msSleep(UINT32 ms)
Sleeps ms milliseconds.
SINT32 integrateDOMNode(const DOMNode *srcNode, DOMNode *dstNode, bool recursive, bool replace)
integrates the source node in the destination Node.
SINT32 compDate(struct tm *date1, struct tm *date2)
SINT32 parseUINT16(const UINT8 *str, UINT16 &value)
Parses a timestamp in JDBC timestamp escape format (as it comes from the BI) and outputs the value in...
#define XML_ENCODE_KEY_TEMPLATE
SINT32 filesize32(int handle)
void print64(UINT8 *buff, UINT64 num)
#define INTEGRATE_NOT_ALLOWED_POSITIONS
#define UNIVERSAL_ATTRIBUTE_LAST_UPDATE
#define ASSERT(cond, msg)
struct __UINT64__t_ UINT64
SINT32 decryptOAEP(const UINT8 *from, UINT8 *to, UINT32 *len)
Decrypts one OAEP encoded block which is stored in from.
SINT32 encryptOAEP(const UINT8 *from, UINT32 fromlen, UINT8 *to, UINT32 *len)
Encrypts one block of plain text using OAEP padding.
SINT32 decrypt(const UINT8 *from, UINT8 *to)
Decrypts exactly one block which is stored in from.
SINT32 encrypt(const UINT8 *from, UINT8 *to)
Encrypts exactly one block which is stored in from.
static SINT32 encode(const UINT8 *in, UINT32 len, UINT8 *out, UINT32 *outlen)
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
static SINT32 decode(const UINT8 *in, UINT32 len, UINT8 *out, UINT32 *outlen)
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
This class could be used for encryption/decryption of data (streams) with AES using 128bit CBC mode.
SINT32 encryptCBCwithPKCS7(const UINT8 *in, UINT32 inlen, UINT8 *out, UINT32 *len)
En-/Decryptes in to out using IV1 and key1.
SINT32 setIV(const UINT8 *p_iv)
Sets iv to p_iv.
SINT32 setKey(const UINT8 *key)
Sets the key for encryption.
SINT32 decryptCBCwithPKCS7(const UINT8 *in, UINT8 *out, UINT32 *len)
En-/Decryptes in to out using iv1 and key1.
static SINT32 dumpToMem(const DOMNode *node, UINT8 *buff, UINT32 *size)
Dumps the node and all childs into buff.