• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kssl
 

kio/kssl

  • kio
  • kssl
ksslutils.cc
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2000,2001 George Staikos <staikos@kde.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #include "ksslutils.h"
23 
24 #include <tqstring.h>
25 #include <kglobal.h>
26 #include <klocale.h>
27 #include <tqdatetime.h>
28 
29 #include "kopenssl.h"
30 
31 #ifdef KSSL_HAVE_SSL
32 // This code is mostly taken from OpenSSL v0.9.5a
33 // by Eric Young
34 TQDateTime ASN1_UTCTIME_QDateTime(ASN1_UTCTIME *tm, int *isGmt) {
35 TQDateTime qdt;
36 char *v;
37 int gmt=0;
38 int i;
39 int y=0,M=0,d=0,h=0,m=0,s=0;
40 TQDate qdate;
41 TQTime qtime;
42 
43  i = tm->length;
44  v = (char *)tm->data;
45 
46  if (i < 10) goto auq_err;
47  if (v[i-1] == 'Z') gmt=1;
48  for (i=0; i<10; i++)
49  if ((v[i] > '9') || (v[i] < '0')) goto auq_err;
50  y = (v[0]-'0')*10+(v[1]-'0');
51  if (y < 50) y+=100;
52  M = (v[2]-'0')*10+(v[3]-'0');
53  if ((M > 12) || (M < 1)) goto auq_err;
54  d = (v[4]-'0')*10+(v[5]-'0');
55  h = (v[6]-'0')*10+(v[7]-'0');
56  m = (v[8]-'0')*10+(v[9]-'0');
57  if ( (v[10] >= '0') && (v[10] <= '9') &&
58  (v[11] >= '0') && (v[11] <= '9'))
59  s = (v[10]-'0')*10+(v[11]-'0');
60 
61  // localize the date and display it.
62  qdate.setYMD(y+1900, M, d);
63  qtime.setHMS(h,m,s);
64  qdt.setDate(qdate); qdt.setTime(qtime);
65  auq_err:
66  if (isGmt) *isGmt = gmt;
67 return qdt;
68 }
69 
70 
71 TQString ASN1_UTCTIME_QString(ASN1_UTCTIME *tm) {
72  TQString qstr;
73  int gmt;
74  TQDateTime qdt = ASN1_UTCTIME_QDateTime(tm, &gmt);
75 
76  qstr = KGlobal::locale()->formatDateTime(qdt, false, true);
77  if (gmt) {
78  qstr += " ";
79  qstr += i18n("GMT");
80  }
81  return qstr;
82 }
83 
84 
85 TQString ASN1_INTEGER_QString(ASN1_INTEGER *aint) {
86 char *rep = KOSSL::self()->i2s_ASN1_INTEGER(NULL, aint);
87 TQString yy = rep;
88 KOSSL::self()->OPENSSL_free(rep);
89 return yy;
90 }
91 
92 
93 #endif
94 

kio/kssl

Skip menu "kio/kssl"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kio/kssl

Skip menu "kio/kssl"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kssl by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |