Mixe for Privacy and Anonymity in the Internet
CAUtil.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2000, The JAP-Team
3 All rights reserved.
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6 
7  - Redistributions of source code must retain the above copyright notice,
8  this list of conditions and the following disclaimer.
9 
10  - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13 
14  - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
15  may be used to endorse or promote products derived from this software without specific
16  prior written permission.
17 
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
20 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
27 */
28 #ifndef __CA_UTIL__
29 #define __CA_UTIL__
30 #include "CAASymCipher.hpp"
31 
32 #define UNIVERSAL_ATTRIBUTE_LAST_UPDATE "lastUpdate"
33 #define UNIVERSAL_NODE_LAST_UPDATE "LastUpdate"
34 
35 #define STR_VALUE_TRUE "true"
36 #define STR_VALUE_FALSE "false"
37 
38 #define TMP_BUFF_SIZE 255
39 #define TMP_LOCALE_SIZE 3
40 #define TMP_DATE_SIZE 9
41 
42 #define TEMPLATE_REFID_MAXLEN ((TMP_BUFF_SIZE) + (TMP_LOCALE_SIZE) + (TMP_DATE_SIZE) + 2)
43 
44 #if _XERCES_VERSION >= 30001
45  #define INTEGRATE_NOT_ALLOWED_POSITIONS \
46  (DOMNode::DOCUMENT_POSITION_CONTAINED_BY | DOMNode::DOCUMENT_POSITION_CONTAINS )
47 #else
48  #define INTEGRATE_NOT_ALLOWED_POSITIONS \
49  (DOMNode::TREE_POSITION_ANCESTOR | DOMNode::TREE_POSITION_DESCENDANT | \
50  DOMNode::TREE_POSITION_EQUIVALENT | DOMNode::TREE_POSITION_SAME_NODE )
51 #endif
52 
54 UINT32 toLower(UINT8* a_string);
55 
56 SINT32 memtrim(UINT8* out,const UINT8* in,UINT32 len);
57 
59 UINT8* bytes2hex(const void* bytes,UINT32 len);
60 
61 char* strins(const char* src,UINT32 pos,const char* ins);
62 char* strins(const char* src,const char * pos,const char* ins);
63 
64 SINT32 getcurrentTime(timespec& t);
67 
68 SINT32 compDate(struct tm *date1, struct tm *date2);
69 
72 
73 SINT32 getRandom(UINT16* val);
74 
75 SINT32 getRandom(UINT32* val);
76 
77 SINT32 getRandom(UINT64* val);
78 
80 
81 SINT32 sSleep(UINT32 sec);
82 
84 
85 inline SINT64 filesize64(int handle)
86  {
87  #ifdef _WIN32
88  return _filelengthi64(handle);
89  #elif defined (HAVE_FSTAT64)
90  struct stat64 info;
91  if(fstat64(handle, &info) != 0)
92  return E_UNKNOWN;
93  return info.st_size;
94  #else
95  struct stat info;
96  if(fstat(handle, &info) != 0)
97  return E_UNKNOWN;
98  return info.st_size;
99  #endif
100  }
101 
102 inline SINT32 filesize32(int handle)
103  {
104  #ifdef _WIN32
105  return _filelength(handle);
106  #else
107  struct stat info;
108  if(fstat(handle, &info) != 0)
109  return E_UNKNOWN;
110  return info.st_size;
111  #endif
112  }
113 
117 XERCES_CPP_NAMESPACE::DOMDocument* parseDOMDocument(const UINT8* const buff, UINT32 len);
121 XERCES_CPP_NAMESPACE::DOMDocument* parseDOMDocument(const UINT8* const pathOrURL);
122 void initDOMParser();
123 void releaseDOMParser();
124 
125 SINT32 getDOMChildByName(const DOMNode* pNode,const XMLCh* const name,DOMNode* & child,bool deep=false);
126 SINT32 getDOMChildByName(const DOMNode* pNode,const char * const name,DOMNode* & child,bool deep=false);
127 SINT32 getDOMChildByName(const DOMNode* pNode,const char * const name,DOMElement* & child,bool deep=false);
128 SINT32 getSignatureElements(DOMNode* parent, DOMNode** signatureNodes, UINT32* length);
129 
140 SINT32 getDOMElementValue(const DOMNode * const pElem,UINT8* value,UINT32* len);
141 
142 SINT32 setDOMElementAttribute(DOMNode* pElem,const char* attrName,const UINT8* value);
143 SINT32 setDOMElementAttribute(DOMNode *pElem, const char *attrName, const char *value);
144 
145 bool equals(const XMLCh* const e1,const char* const e2);
146 
147 SINT32 getDOMElementAttribute(const DOMNode * const pElem,const char* attrName,SINT32* value);
148 
151 DOMElement* createDOMElement(XERCES_CPP_NAMESPACE::DOMDocument* pOwnerDoc,const char * const name);
152 
155 DOMText* createDOMText(XERCES_CPP_NAMESPACE::DOMDocument* pOwnerDoc,const char * const text);
156 
159 SINT32 getDOMElementValue(const DOMElement * const pElem, UINT32& value, UINT32 defaultValue);
160 
161 SINT32 getDOMElementValue(const DOMElement * const pElem, UINT32* value);
162 
163 
164 #if !defined LOCAL_PROXY_ONLY || defined INCLUDE_MIDDLE_MIX
167  XERCES_CPP_NAMESPACE::DOMDocument* createDOMDocument();
168  SINT32 encodeXMLEncryptedKey(UINT8* key,UINT32 keylen, UINT8* xml, UINT32* xmllen,CAASymCipher* pRSA);
169  SINT32 encodeXMLEncryptedKey(UINT8* key,UINT32 keylen, DOMElement* & elemRootEncodedKey,XERCES_CPP_NAMESPACE::DOMDocument* docOwner,CAASymCipher* pRSA);
170  SINT32 decodeXMLEncryptedKey(UINT8* key,UINT32* keylen, const UINT8* const xml, UINT32 xmllen,CAASymCipher* pRSA);
171  SINT32 decodeXMLEncryptedKey(UINT8* key,UINT32* keylen, const DOMNode* pRoot,CAASymCipher* pRSA);
172  SINT32 getDOMElementValue(const DOMElement * const pElem,UINT16* value);
173  SINT32 setDOMElementValue(DOMElement* pElem,const UINT8* value);
174  SINT32 setDOMElementValue(DOMElement* pElem, UINT32 value);
175  SINT32 setDOMElementAttribute(DOMNode* pElem,const char* attrName, UINT32 value);
176  SINT32 getDOMElementAttribute(const DOMNode * const pElem,const char* attrName,UINT32& value);
177  SINT32 getDOMElementAttribute(const DOMNode * const pElem,const char* attrName,UINT8* value,UINT32* len);
178  SINT32 getDOMElementAttribute(const DOMNode * const pElem,const char* attrName,SINT64& value);
179  SINT32 getDOMElementAttribute(const DOMNode * const pElem,const char* attrName,bool& value);
180  SINT32 getNodeName(const DOMNode * const pElem, UINT8* value,UINT32* valuelen);
181  SINT32 getLastDOMChildByName(const DOMNode* pNode,const char * const name,DOMElement* & a_child);
182  SINT32 getLastDOMChildByName(const DOMNode* pNode,const XMLCh* const name,DOMNode* & a_child);
183  SINT32 getLastDOMChildByName(const DOMNode* pNode,const char * const name,DOMNode* & a_child);
184 
185  DOMNodeList* getElementsByTagName(DOMElement* pElem,const char* const name);
186 
187 
191 inline DSA* DSA_clone(DSA* dsa)
192  {
193  if(dsa==NULL)
194  return NULL;
195  DSA* tmpDSA=DSA_new();
196 #if OPENSSL_VERSION_NUMBER > 0x100020cfL
197  BIGNUM* p = NULL;
198  BIGNUM* q = NULL;
199  BIGNUM* g = NULL;
200  BIGNUM* pub_key = NULL;
201  BIGNUM* priv_key = NULL;
202  DSA_get0_pqg(dsa,(const BIGNUM**) &p,(const BIGNUM**) &q,(const BIGNUM**) &g);
203  DSA_set0_pqg(tmpDSA,BN_dup(p), BN_dup(q), BN_dup(g));
204  DSA_get0_key(dsa,(const BIGNUM**) &pub_key,(const BIGNUM**) &priv_key);
205  DSA_set0_key(tmpDSA,BN_dup(pub_key), BN_dup(priv_key));
206 #else
207  tmpDSA->g=BN_dup(dsa->g);
208  tmpDSA->p=BN_dup(dsa->p);
209  tmpDSA->q=BN_dup(dsa->q);
210  tmpDSA->pub_key=BN_dup(dsa->pub_key);
211  if(dsa->priv_key!=NULL)
212  tmpDSA->priv_key=BN_dup(dsa->priv_key);
213 #endif
214  return tmpDSA;
215  }
216 
220 inline RSA* RSA_clone(RSA* rsa)
221  {
222  if(rsa == NULL)
223  {
224  return NULL;
225  }
226 #if OPENSSL_VERSION_NUMBER >= 0x1000204fL
227  return RSAPrivateKey_dup(rsa);
228 #else
229  RSA* tmpRSA = RSA_new();
230  tmpRSA->n = BN_dup(rsa->n);
231  tmpRSA->e = BN_dup(rsa->e);
232  if(rsa->d != NULL)
233  { //we have a private key
234  tmpRSA->d = BN_dup(rsa->d);
235  if(tmpRSA->p != NULL)
236  {
237  tmpRSA->p = BN_dup(rsa->p);
238  }
239  if(tmpRSA->q != NULL)
240  {
241  tmpRSA->q = BN_dup(rsa->q);
242  }
243  }
244  if(tmpRSA->dmp1 != NULL)
245  {
246  tmpRSA->dmp1 = BN_dup(rsa->dmp1);
247  }
248  if(tmpRSA->dmq1 != NULL)
249  {
250  tmpRSA->dmq1 = BN_dup(rsa->dmq1);
251  }
252  if(tmpRSA->iqmp != NULL)
253  {
254  tmpRSA->iqmp = BN_dup(rsa->iqmp);
255  }
256  return tmpRSA;
257 #endif
258  }
259 
260 
261 #endif
262 
263 #ifndef ONLY_LOCAL_PROXY
264 
267 DOMText* createDOMText(XERCES_CPP_NAMESPACE::DOMDocument* pOwnerDoc,const char * const text);
268 
269 SINT32 setDOMElementValue(DOMElement* pElem, SINT32 value);
279 SINT32 setDOMElementValue(DOMElement* pElem, const UINT64 text);
280 SINT32 setDOMElementValue(DOMElement* pElem, const SINT64 text);
281 
282 
283 SINT32 getDOMElementValue(const DOMNode * const pElem, UINT64 &value);
284 SINT32 getDOMElementValue(const DOMElement * const pElem, SINT64 &value);
285 
286 SINT32 getDOMElementValue(const DOMElement * const pElem,SINT32* value);
287 
288 
289 SINT32 getDOMElementValue(const DOMElement * const pElem,double* value);
290 
291 SINT32 setDOMElementAttribute(DOMNode* pElem,const char* attrName, bool value);
292 SINT32 setDOMElementAttribute(DOMNode* pElem,const char* attrName, SINT32 value);
293 SINT32 setDOMElementAttribute(DOMNode* pElem, const char* attrName, UINT64 value);
294 SINT32 setDOMElementAttribute(DOMNode* pElem, const char* attrName, SINT64 value);
295 
296 SINT32 setDOMElementValue(DOMElement* pElem,double floatValue);
297 SINT32 setDOMElementValue(DOMElement* pElem, bool value);
298 
299 
301 
302 
303 SINT32 integrateDOMNode(const DOMNode *srcNode, DOMNode *dstNode, bool recursive, bool replace);
304 
306 SINT32 encryptXMLElement(DOMNode* pElem , CAASymCipher* pRSA);
307 
308 #endif //ONLY_LOCAL_PROXY
309 
310 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
311 
313 SINT32 decryptXMLElement(DOMNode* pelem , CAASymCipher* pRSA);
314 //if not null the returned char pointer must be explicitely freed by the caller with 'delete []'
315 UINT8 *getTermsAndConditionsTemplateRefId(DOMNode *tcTemplateRoot);
316 
317 #endif
318 
319 UINT8* encryptXMLElement(UINT8* inbuff,UINT32 inlen,UINT32& outlen,CAASymCipher* pRSA);
320 
321 inline void set64(UINT64& op1,UINT32 op2)
322  {
323 #if !defined(HAVE_NATIVE_UINT64)
324  op1.low=op2;
325  op1.high=0;
326 #else
327  op1=op2;
328 #endif
329  }
330 
333 inline void set64(UINT64& dst,UINT64 src)
334  {
335 #if !defined(HAVE_NATIVE_UINT64)
336  dst.low=src.low;
337  dst.high=src.high;
338 #else
339  dst=src;
340 #endif
341  }
342 
345 inline void set64(SINT64& dst,SINT64 src)
346  {
347 #if !defined(HAVE_NATIVE_UINT64)
348  dst.low=src.low;
349  dst.high=src.high;
350 #else
351  dst=src;
352 #endif
353  }
354 
355 inline void setZero64(UINT64& op1)
356  {
357 #if !defined(HAVE_NATIVE_UINT64)
358  op1.low=0;
359  op1.high=0;
360 #else
361  op1=0;
362 #endif
363  }
364 
365 inline void setZero64(SINT64& op1)
366  {
367 #if !defined(HAVE_NATIVE_UINT64)
368  op1.low=0;
369  op1.high=0;
370 #else
371  op1=0;
372 #endif
373  }
374 
375 inline void add64(UINT64& op1,UINT32 op2)
376  {
377 #if !defined(HAVE_NATIVE_UINT64)
378  UINT32 t=op1.low;
379  op1.low+=op2;
380  if(op1.low<t)
381  op1.high++;
382 #else
383  op1+=op2;
384 #endif
385  }
386 
387 inline void inc64(UINT64& op1)
388  {
389 #if !defined(HAVE_NATIVE_UINT64)
390  op1.low++;
391  if(op1.low==0)
392  op1.high++;
393 #else
394  op1++;
395 #endif
396  }
397 
398 inline UINT32 diff64(const UINT64& bigop,const UINT64& smallop)
399  {
400  #if !defined(HAVE_NATIVE_UINT64)
401  return (UINT32) -1; //TODO!!!
402  #else
403  return (UINT32)(bigop-smallop);
404  #endif
405  }
406 
407 inline UINT32 div64(UINT64& op1,UINT32 op2)
408  {
409 #if !defined(HAVE_NATIVE_UINT64)
410  return (UINT32) -1; //TODO!!!
411 #else
412  return (UINT32)(op1/op2);
413 #endif
414  }
415 
416 inline bool isGreater64(UINT64& op1,UINT64& op2)
417  {
418 #if !defined(HAVE_NATIVE_UINT64)
419  if(op1.high>op2.high)
420  return true;
421  if(op1.high==op2.high)
422  return op1.low>op2.low;
423  return false;
424 #else
425  return op1>op2;
426 #endif
427  }
428 
429 inline bool isGreater64(SINT64 op1,SINT64 op2)
430  {
431 #if !defined(HAVE_NATIVE_UINT64)
432  if(op1.high>op2.high)
433  return true;
434  if(op1.high==op2.high)
435  return op1.low>op2.low;
436  return false;
437 #else
438  return op1>op2;
439 #endif
440  }
441 
442 inline bool isLesser64(UINT64& smallOp1,UINT64& bigOp2)
443  {
444 #if !defined(HAVE_NATIVE_UINT64)
445  if(smallOp1.high<bigOp2.high)
446  return true;
447  if(smallOp1.high==bigOp2.high)
448  return smallOp1.low<bigOp2.low;
449  return false;
450 #else
451  return smallOp1<bigOp2;
452 #endif
453  }
454 
455 inline bool isEqual64(UINT64& op1,UINT64& op2)
456  {
457 #if !defined(HAVE_NATIVE_UINT64)
458  return (op1.high==op2.high)&&op1.low==op2.low;
459 #else
460  return op1==op2;
461 #endif
462  }
463 
464 inline bool isZero64(UINT64& op1)
465  {
466 #if !defined(HAVE_NATIVE_UINT64)
467  return (op1.high==0)&&op1.low==0;
468 #else
469  return op1==0;
470 #endif
471  }
472 
473 inline bool isZero64(SINT64& op1)
474  {
475 #if !defined(HAVE_NATIVE_UINT64)
476  return (op1.high==0)&&op1.low==0;
477 #else
478  return op1==0;
479 #endif
480  }
481 
482 inline void print64(UINT8* buff,UINT64 num)
483  {
484  #ifdef HAVE_NATIVE_UINT64
485  if(num==0)
486  {
487  buff[0]='0';
488  buff[1]=0;
489  return;
490  }
491  UINT64 mask=10000000000000000000ULL;
492  UINT32 index=0;
493  bool bprintZero=false;
494  if(num>=mask)
495  {
496  buff[index++]='1';
497  num-=mask;
498  bprintZero=true;
499  }
500  while(mask>1)
501  {
502  mask/=10;
503  UINT digit=(UINT)(num/mask);
504  if(digit>0||bprintZero)
505  {
506  buff[index++]=(UINT8)(digit+'0');
507  num%=mask;
508  bprintZero=true;
509  }
510  }
511  buff[index]=0;
512  #else //no native UINT_64
513  sprintf((char*)buff,"(%lu:%lu)",op.high,op.low);
514  #endif
515  }
516 
517 
518 UINT8* readFile(const UINT8* const name,UINT32* size);
519 SINT32 saveFile(const UINT8* const name,const UINT8* const buff,UINT32 buffSize);
520 
528 //SINT32 parseJdbcTimestamp(const UINT8 * strTimestamp, SINT32& seconds);
529 
530 
539 //SINT32 formatJdbcTimestamp(const SINT32 seconds, UINT8 * strTimestamp, const UINT32 len);
540 
541 
545 SINT32 parseUINT16(const UINT8 * str, UINT16& value);
546 
550 SINT32 parseU64(const UINT8 * str, UINT64& value);
551 
555 SINT32 parseS64(const UINT8 * str, SINT64& value);
556 
560 
561 /*** Formats the "bytes per second" input value as human readable string.***/
562 
563 void formatBytesPerSecond(UINT8* buff, UINT32 buffsize, UINT64 bytespersecond);
564 
565 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_LAST_MIX
566 void logMemoryUsage();
567 #endif //ONLY_LOCAL_PROXY
568 
569 #endif
SINT32 getNodeName(const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
Definition: CAUtil.cpp:707
UINT32 diff64(const UINT64 &bigop, const UINT64 &smallop)
Definition: CAUtil.hpp:398
UINT8 * bytes2hex(const void *bytes, UINT32 len)
Converts the byte array to a hex string.
Definition: CAUtil.cpp:90
SINT32 getcurrentTimeMillis(UINT64 &u64Time)
Gets the current Systemtime in milli seconds.
Definition: CAUtil.cpp:252
UINT8 * readFile(const UINT8 *const name, UINT32 *size)
ONLY_LOCAL_PROXY or first.
Definition: CAUtil.cpp:1330
SINT32 setCurrentTimeMilliesAsDOMAttribute(DOMNode *pElem)
Definition: CAUtil.cpp:848
SINT32 readPasswd(UINT8 *buff, UINT32 len)
Read a passwd (i.e.
Definition: CAUtil.cpp:1473
char * strins(const char *src, UINT32 pos, const char *ins)
Inserts a String ins in a String src starting after pos chars.
Definition: CAUtil.cpp:148
DSA * DSA_clone(DSA *dsa)
Clones an OpenSSL DSA structure.
Definition: CAUtil.hpp:191
SINT32 getcurrentTimeMicros(UINT64 &u64Time)
Gets the current Systemtime in micros seconds.
Definition: CAUtil.cpp:280
SINT32 initRandom()
Definition: CAUtil.cpp:302
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.
Definition: CAUtil.cpp:822
SINT32 setDOMElementAttribute(DOMNode *pElem, const char *attrName, const UINT8 *value)
Definition: CAUtil.cpp:836
SINT32 parseS64(const UINT8 *str, SINT64 &value)
Parses a 64bit signed integer.
Definition: CAUtil.cpp:1430
SINT32 encryptXMLElement(DOMNode *pElem, CAASymCipher *pRSA)
Replaces a DOM element with an encrypted version of this element.
Definition: CAUtil.cpp:1086
UINT32 getMemoryUsage()
Definition: CAUtil.cpp:443
SINT32 getRandom(UINT8 *buff, UINT32 len)
Gets some random bytes.
Definition: CAUtil.cpp:393
bool equals(const XMLCh *const e1, const char *const e2)
Definition: CAUtil.cpp:645
bool isEqual64(UINT64 &op1, UINT64 &op2)
Definition: CAUtil.hpp:455
SINT32 sSleep(UINT32 sec)
Sleeps sec Seconds.
Definition: CAUtil.cpp:425
void setZero64(UINT64 &op1)
Definition: CAUtil.hpp:355
UINT8 * getTermsAndConditionsTemplateRefId(DOMNode *tcTemplateRoot)
Definition: CAUtil.cpp:865
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument(const UINT8 *const buff, UINT32 len)
Parses a buffer containing an XML document and returns this document.
Definition: CAUtil.cpp:663
DOMNodeList * getElementsByTagName(DOMElement *pElem, const char *const name)
Definition: CAUtil.cpp:1711
SINT32 memtrim(UINT8 *out, const UINT8 *in, UINT32 len)
Removes leading and ending whitespaces (chars<=32) from a byte array.
Definition: CAUtil.cpp:126
SINT32 parseU64(const UINT8 *str, UINT64 &value)
Parses a 64bit unsigned integer.
Definition: CAUtil.cpp:1378
SINT32 getDOMElementAttribute(const DOMNode *const pElem, const char *attrName, SINT32 *value)
Definition: CAUtil.cpp:804
UINT32 div64(UINT64 &op1, UINT32 op2)
Definition: CAUtil.hpp:407
UINT32 strtrim(UINT8 *)
Removes leading and ending whitespaces (chars<=32) from a zero terminated string.
Definition: CAUtil.cpp:49
void initDOMParser()
Definition: CAUtil.cpp:656
XERCES_CPP_NAMESPACE::DOMDocument * createDOMDocument()
Creates an empty DOM DOcument.
Definition: CAUtil.cpp:1568
SINT32 filesize32(int handle)
Definition: CAUtil.hpp:102
void inc64(UINT64 &op1)
Definition: CAUtil.hpp:387
void releaseDOMParser()
Definition: CAUtil.cpp:694
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.
Definition: CAUtil.cpp:814
SINT32 decryptXMLElement(DOMNode *pelem, CAASymCipher *pRSA)
Replaces a DOM element with a deencrypted version of this element.
Definition: CAUtil.cpp:1224
SINT32 getcurrentTime(timespec &t)
Gets the current Systemtime in milli seconds.
Definition: CAUtil.cpp:227
SINT64 filesize64(int handle)
Definition: CAUtil.hpp:85
RSA * RSA_clone(RSA *rsa)
Clones an OpenSSL RSA structure.
Definition: CAUtil.hpp:220
UINT32 toLower(UINT8 *a_string)
Definition: CAUtil.cpp:74
void formatBytesPerSecond(UINT8 *buff, UINT32 buffsize, UINT64 bytespersecond)
Definition: CAUtil.cpp:1821
bool isZero64(UINT64 &op1)
Definition: CAUtil.hpp:464
void logMemoryUsage()
Log information about the current memory (heap) usage.
Definition: CAUtil.cpp:177
void print64(UINT8 *buff, UINT64 num)
Definition: CAUtil.hpp:482
SINT32 saveFile(const UINT8 *const name, const UINT8 *const buff, UINT32 buffSize)
Definition: CAUtil.cpp:1352
SINT32 encodeXMLEncryptedKey(UINT8 *key, UINT32 keylen, UINT8 *xml, UINT32 *xmllen, CAASymCipher *pRSA)
Definition: CAUtil.cpp:1683
void add64(UINT64 &op1, UINT32 op2)
Definition: CAUtil.hpp:375
SINT32 getLastDOMChildByName(const DOMNode *pNode, const char *const name, DOMElement *&a_child)
Definition: CAUtil.cpp:1719
SINT32 decodeXMLEncryptedKey(UINT8 *key, UINT32 *keylen, const UINT8 *const xml, UINT32 xmllen, CAASymCipher *pRSA)
Definition: CAUtil.cpp:1625
bool isGreater64(UINT64 &op1, UINT64 &op2)
Definition: CAUtil.hpp:416
bool isLesser64(UINT64 &smallOp1, UINT64 &bigOp2)
Definition: CAUtil.hpp:442
SINT32 getDOMElementValue(const DOMNode *const pElem, UINT8 *value, UINT32 *len)
Returns the content of the text node(s) under elem as null-terminated C String.
Definition: CAUtil.cpp:746
SINT32 getSignatureElements(DOMNode *parent, DOMNode **signatureNodes, UINT32 *length)
Definition: CAUtil.cpp:496
void set64(UINT64 &op1, UINT32 op2)
Definition: CAUtil.hpp:321
SINT32 msSleep(UINT32 ms)
Sleeps ms milliseconds.
Definition: CAUtil.cpp:406
SINT32 getDOMChildByName(const DOMNode *pNode, const XMLCh *const name, DOMNode *&child, bool deep=false)
Definition: CAUtil.cpp:462
SINT32 integrateDOMNode(const DOMNode *srcNode, DOMNode *dstNode, bool recursive, bool replace)
integrates the source node in the destination Node.
Definition: CAUtil.cpp:533
SINT32 compDate(struct tm *date1, struct tm *date2)
Definition: CAUtil.cpp:323
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...
Definition: CAUtil.cpp:1367
SINT32 setDOMElementValue(DOMElement *pElem, const UINT8 *value)
Definition: CAUtil.cpp:1582
unsigned short UINT16
Definition: basetypedefs.h:133
unsigned int UINT
Definition: basetypedefs.h:155
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
#define E_UNKNOWN
Definition: errorcodes.hpp:3
UINT16 len
Definition: typedefs.hpp:0