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

kio/kssl

  • kio
  • kssl
ksslsession.cc
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2003 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 #include "ksslsession.h"
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <kopenssl.h>
28 #include <kmdcodec.h>
29 
30 KSSLSession::KSSLSession() : _session(0L) {
31 }
32 
33 
34 KSSLSession::~KSSLSession() {
35 #ifdef KSSL_HAVE_SSL
36  if (_session) {
37  KOpenSSLProxy::self()->SSL_SESSION_free(static_cast<SSL_SESSION*>(_session));
38  _session = 0L;
39  }
40 #endif
41 }
42 
43 
44 TQString KSSLSession::toString() const {
45 TQString rc;
46 #ifdef KSSL_HAVE_SSL
47 TQByteArray qba;
48 SSL_SESSION *session = static_cast<SSL_SESSION*>(_session);
49 unsigned int slen = KOpenSSLProxy::self()->i2d_SSL_SESSION(session, 0L);
50 unsigned char *csess = new unsigned char[slen];
51 unsigned char *p = csess;
52 
53  if (!KOpenSSLProxy::self()->i2d_SSL_SESSION(session, &p)) {
54  delete[] csess;
55  return TQString::null;
56  }
57 
58  // encode it into a QString
59  qba.duplicate((const char*)csess, slen);
60  delete[] csess;
61  rc = KCodecs::base64Encode(qba);
62 #endif
63 return rc;
64 }
65 
66 
67 KSSLSession *KSSLSession::fromString(const TQString& s) {
68 KSSLSession *session = 0L;
69 #ifdef KSSL_HAVE_SSL
70 TQByteArray qba, qbb = s.local8Bit().copy();
71  KCodecs::base64Decode(qbb, qba);
72  unsigned char *qbap = reinterpret_cast<unsigned char *>(qba.data());
73  SSL_SESSION *ss = KOSSL::self()->d2i_SSL_SESSION(0L, &qbap, qba.size());
74  if (ss) {
75  session = new KSSLSession;
76  session->_session = ss;
77  }
78 #endif
79 return session;
80 }
81 
82 

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. |