22 #include "ksslutils.h"
25 #include <tdeglobal.h>
26 #include <tdelocale.h>
27 #include <tqdatetime.h>
34 TQDateTime ASN1_UTCTIME_QDateTime(ASN1_UTCTIME *tm,
int *isGmt) {
42 int y=0,M=0,d=0,h=0,m=0,s=0;
48 if ((i == 15) || (i == 21)) {
53 if (i < 10)
goto auq_err;
54 if (v[i-1] ==
'Z') gmt=1;
55 for (i=0; i<10+yoffset; i++)
56 if ((v[i] >
'9') || (v[i] <
'0'))
goto auq_err;
57 y = (v[0+yoffset]-
'0')*10+(v[1+yoffset]-
'0');
59 y += (v[0]-
'0')*1000+(v[1]-
'0')*100;
61 M = (v[2+yoffset]-
'0')*10+(v[3+yoffset]-
'0');
62 if ((M > 12) || (M < 1))
goto auq_err;
63 d = (v[4+yoffset]-
'0')*10+(v[5+yoffset]-
'0');
64 h = (v[6+yoffset]-
'0')*10+(v[7+yoffset]-
'0');
65 m = (v[8+yoffset]-
'0')*10+(v[9+yoffset]-
'0');
66 if ( (v[10+yoffset] >=
'0') && (v[10+yoffset] <=
'9') &&
67 (v[11+yoffset] >=
'0') && (v[11+yoffset] <=
'9'))
68 s = (v[10+yoffset]-
'0')*10+(v[11+yoffset]-
'0');
71 qdate.setYMD(y+yearbase, M, d);
73 qdt.setDate(qdate); qdt.setTime(qtime);
75 if (isGmt) *isGmt = gmt;
80 TQString ASN1_UTCTIME_QString(ASN1_UTCTIME *tm) {
83 TQDateTime qdt = ASN1_UTCTIME_QDateTime(tm, &gmt);
85 qstr = TDEGlobal::locale()->formatDateTime(qdt,
false,
true);
94 TQString ASN1_INTEGER_QString(ASN1_INTEGER *aint) {
95 char *rep = KOSSL::self()->i2s_ASN1_INTEGER(NULL, aint);
97 KOSSL::self()->CRYPTO_free(rep);