| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# ksslsigners.cc

    00001 /* This file is part of the KDE project
    00002  *
    00003  * Copyright (C) 2001 George Staikos <staikos@kde.org>
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Library General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2 of the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful,
    00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Library General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Library General Public License
    00016  * along with this library; see the file COPYING.LIB.  If not, write to
    00017  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018  * Boston, MA 02111-1307, USA.
    00019  */
    00020
    00021
    00022 #include <qstring.h>
    00023 #include <qstringlist.h>
    00024 #include "ksslcertificate.h"
    00025 #include "ksslsigners.h"
    00026 #include <stdlib.h>
    00027 #include <kdebug.h>
    00028 #include <dcopclient.h>
    00029 #include <kdatastream.h>
    00030
    00031
    00032 KSSLSigners::KSSLSigners() {
    00033         dcc = new DCOPClient;
    00034         dcc->attach();
    00035 }
    00036
    00037
    00038 KSSLSigners::~KSSLSigners() {
    00039         delete dcc;
    00040 }
    00041
    00042 bool KSSLSigners::addCA(KSSLCertificate& cert,
    00043                         bool ssl,
    00044                         bool email,
    00045                         bool code) {
    00046         return addCA(cert.toString(), ssl, email, code);
    00047 }
    00048
    00049
    00050 bool KSSLSigners::addCA(QString cert,
    00051                         bool ssl,
    00052                         bool email,
    00053                         bool code) {
    00054      QByteArray data, retval;
    00055      QCString rettype;
    00056      QDataStream arg(data, IO_WriteOnly);
    00057      arg << cert;
    00058      arg << ssl << email << code;
    00059      bool rc = dcc->call("kded", "kssld",
    00060                          "caAdd(QString,bool,bool,bool)",
    00061                          data, rettype, retval);
    00062
    00063      if (rc && rettype == "bool") {
    00064         QDataStream retStream(retval, IO_ReadOnly);
    00065         bool drc;
    00066         retStream >> drc;
    00067         return drc;
    00068      }
    00069
    00070 return false;
    00071 }
    00072
    00073
    00074 bool KSSLSigners::regenerate() {
    00075      QByteArray data, retval;
    00076      QCString rettype;
    00077      QDataStream arg(data, IO_WriteOnly);
    00078      bool rc = dcc->call("kded", "kssld",
    00079                          "caRegenerate()",
    00080                          data, rettype, retval);
    00081
    00082      if (rc && rettype == "bool") {
    00083         QDataStream retStream(retval, IO_ReadOnly);
    00084         bool drc;
    00085         retStream >> drc;
    00086         return drc;
    00087      }
    00088
    00089 return false;
    00090 }
    00091
    00092
    00093 bool KSSLSigners::useForSSL(KSSLCertificate& cert) {
    00094         return useForSSL(cert.getSubject());
    00095 }
    00096
    00097
    00098 bool KSSLSigners::useForSSL(QString subject) {
    00099      QByteArray data, retval;
    00100      QCString rettype;
    00101      QDataStream arg(data, IO_WriteOnly);
    00102      arg << subject;
    00103      bool rc = dcc->call("kded", "kssld",
    00104                          "caUseForSSL(QString)",
    00105                          data, rettype, retval);
    00106
    00107      if (rc && rettype == "bool") {
    00108         QDataStream retStream(retval, IO_ReadOnly);
    00109         bool drc;
    00110         retStream >> drc;
    00111         return drc;
    00112      }
    00113
    00114 return false;
    00115 }
    00116
    00117
    00118 bool KSSLSigners::useForEmail(KSSLCertificate& cert) {
    00119         return useForEmail(cert.getSubject());
    00120 }
    00121
    00122
    00123 bool KSSLSigners::useForEmail(QString subject) {
    00124      QByteArray data, retval;
    00125      QCString rettype;
    00126      QDataStream arg(data, IO_WriteOnly);
    00127      arg << subject;
    00128      bool rc = dcc->call("kded", "kssld",
    00129                          "caUseForEmail(QString)",
    00130                          data, rettype, retval);
    00131
    00132      if (rc && rettype == "bool") {
    00133         QDataStream retStream(retval, IO_ReadOnly);
    00134         bool drc;
    00135         retStream >> drc;
    00136         return drc;
    00137      }
    00138
    00139 return false;
    00140 }
    00141
    00142
    00143 bool KSSLSigners::useForCode(KSSLCertificate& cert) {
    00144         return useForCode(cert.getSubject());
    00145 }
    00146
    00147
    00148 bool KSSLSigners::useForCode(QString subject) {
    00149      QByteArray data, retval;
    00150      QCString rettype;
    00151      QDataStream arg(data, IO_WriteOnly);
    00152      arg << subject;
    00153      bool rc = dcc->call("kded", "kssld",
    00154                          "caUseForCode(QString)",
    00155                          data, rettype, retval);
    00156
    00157      if (rc && rettype == "bool") {
    00158         QDataStream retStream(retval, IO_ReadOnly);
    00159         bool drc;
    00160         retStream >> drc;
    00161         return drc;
    00162      }
    00163
    00164 return false;
    00165 }
    00166
    00167
    00168 bool KSSLSigners::remove(KSSLCertificate& cert) {
    00169         return remove(cert.getSubject());
    00170 }
    00171
    00172
    00173 bool KSSLSigners::remove(QString subject) {
    00174      QByteArray data, retval;
    00175      QCString rettype;
    00176      QDataStream arg(data, IO_WriteOnly);
    00177      arg << subject;
    00178      bool rc = dcc->call("kded", "kssld",
    00179                          "caRemove(QString)",
    00180                          data, rettype, retval);
    00181
    00182      if (rc && rettype == "bool") {
    00183         QDataStream retStream(retval, IO_ReadOnly);
    00184         bool drc;
    00185         retStream >> drc;
    00186         return drc;
    00187      }
    00188
    00189 return false;
    00190 }
    00191
    00192
    00193 QStringList KSSLSigners::list() {
    00194      QStringList drc;
    00195      QByteArray data, retval;
    00196      QCString rettype;
    00197      QDataStream arg(data, IO_WriteOnly);
    00198      bool rc = dcc->call("kded", "kssld",
    00199                          "caList()",
    00200                          data, rettype, retval);
    00201
    00202      if (rc && rettype == "QStringList") {
    00203         QDataStream retStream(retval, IO_ReadOnly);
    00204         retStream >> drc;
    00205      }
    00206
    00207 return drc;
    00208 }
    00209
    00210
    00211 QString KSSLSigners::getCert(QString subject) {
    00212      QString drc;
    00213      QByteArray data, retval;
    00214      QCString rettype;
    00215      QDataStream arg(data, IO_WriteOnly);
    00216      arg << subject;
    00217      bool rc = dcc->call("kded", "kssld",
    00218                          "caGetCert(QString)",
    00219                          data, rettype, retval);
    00220
    00221      if (rc && rettype == "QString") {
    00222         QDataStream retStream(retval, IO_ReadOnly);
    00223         retStream >> drc;
    00224      }
    00225
    00226 return drc;
    00227 }
    00228
    00229
    00230 bool KSSLSigners::setUse(QString subject, bool ssl, bool email, bool code) {
    00231      QByteArray data, retval;
    00232      QCString rettype;
    00233      QDataStream arg(data, IO_WriteOnly);
    00234      arg << subject << ssl << email << code;
    00235      bool rc = dcc->call("kded", "kssld",
    00236                          "caSetUse(QString,bool,bool,bool)",
    00237                          data, rettype, retval);
    00238
    00239      if (rc && rettype == "bool") {
    00240         QDataStream retStream(retval, IO_ReadOnly);
    00241         bool drc;
    00242         retStream >> drc;
    00243         return drc;
    00244      }
    00245
    00246 return false;
    00247 }
    00248
    00249
    00250
    00251

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:27 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001