diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:04:16 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:04:16 -0600 |
commit | 5159cd2beb2e87806a5b54e9991b7895285c9d3e (patch) | |
tree | 9b70e8be47a390f8f4d56ead812ab0c9dad88709 /tdeio/kssl/ksslsigners.cc | |
parent | c17cb900dcf52b8bd6dc300d4f103392900ec2b4 (diff) | |
download | tdelibs-5159cd2beb2e87806a5b54e9991b7895285c9d3e.tar.gz tdelibs-5159cd2beb2e87806a5b54e9991b7895285c9d3e.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdeio/kssl/ksslsigners.cc')
-rw-r--r-- | tdeio/kssl/ksslsigners.cc | 251 |
1 files changed, 251 insertions, 0 deletions
diff --git a/tdeio/kssl/ksslsigners.cc b/tdeio/kssl/ksslsigners.cc new file mode 100644 index 000000000..028ddf555 --- /dev/null +++ b/tdeio/kssl/ksslsigners.cc @@ -0,0 +1,251 @@ +/* This file is part of the KDE project + * + * Copyright (C) 2001 George Staikos <staikos@kde.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#include <tqstring.h> +#include <tqstringlist.h> +#include "ksslcertificate.h" +#include "ksslsigners.h" +#include <stdlib.h> +#include <kdebug.h> +#include <dcopclient.h> +#include <kdatastream.h> + + +KSSLSigners::KSSLSigners() { + dcc = new DCOPClient; + dcc->attach(); +} + + +KSSLSigners::~KSSLSigners() { + delete dcc; +} + +bool KSSLSigners::addCA(KSSLCertificate& cert, + bool ssl, + bool email, + bool code) { + return addCA(cert.toString(), ssl, email, code); +} + + +bool KSSLSigners::addCA(TQString cert, + bool ssl, + bool email, + bool code) { + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + arg << cert; + arg << ssl << email << code; + bool rc = dcc->call("kded", "kssld", + "caAdd(TQString,bool,bool,bool)", + data, rettype, retval); + + if (rc && rettype == "bool") { + TQDataStream retStream(retval, IO_ReadOnly); + bool drc; + retStream >> drc; + return drc; + } + +return false; +} + + +bool KSSLSigners::regenerate() { + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + bool rc = dcc->call("kded", "kssld", + "caRegenerate()", + data, rettype, retval); + + if (rc && rettype == "bool") { + TQDataStream retStream(retval, IO_ReadOnly); + bool drc; + retStream >> drc; + return drc; + } + +return false; +} + + +bool KSSLSigners::useForSSL(KSSLCertificate& cert) { + return useForSSL(cert.getSubject()); +} + + +bool KSSLSigners::useForSSL(TQString subject) { + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + arg << subject; + bool rc = dcc->call("kded", "kssld", + "caUseForSSL(TQString)", + data, rettype, retval); + + if (rc && rettype == "bool") { + TQDataStream retStream(retval, IO_ReadOnly); + bool drc; + retStream >> drc; + return drc; + } + +return false; +} + + +bool KSSLSigners::useForEmail(KSSLCertificate& cert) { + return useForEmail(cert.getSubject()); +} + + +bool KSSLSigners::useForEmail(TQString subject) { + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + arg << subject; + bool rc = dcc->call("kded", "kssld", + "caUseForEmail(TQString)", + data, rettype, retval); + + if (rc && rettype == "bool") { + TQDataStream retStream(retval, IO_ReadOnly); + bool drc; + retStream >> drc; + return drc; + } + +return false; +} + + +bool KSSLSigners::useForCode(KSSLCertificate& cert) { + return useForCode(cert.getSubject()); +} + + +bool KSSLSigners::useForCode(TQString subject) { + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + arg << subject; + bool rc = dcc->call("kded", "kssld", + "caUseForCode(TQString)", + data, rettype, retval); + + if (rc && rettype == "bool") { + TQDataStream retStream(retval, IO_ReadOnly); + bool drc; + retStream >> drc; + return drc; + } + +return false; +} + + +bool KSSLSigners::remove(KSSLCertificate& cert) { + return remove(cert.getSubject()); +} + + +bool KSSLSigners::remove(TQString subject) { + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + arg << subject; + bool rc = dcc->call("kded", "kssld", + "caRemove(TQString)", + data, rettype, retval); + + if (rc && rettype == "bool") { + TQDataStream retStream(retval, IO_ReadOnly); + bool drc; + retStream >> drc; + return drc; + } + +return false; +} + + +TQStringList KSSLSigners::list() { + TQStringList drc; + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + bool rc = dcc->call("kded", "kssld", + "caList()", + data, rettype, retval); + + if (rc && rettype == TQSTRINGLIST_OBJECT_NAME_STRING) { + TQDataStream retStream(retval, IO_ReadOnly); + retStream >> drc; + } + +return drc; +} + + +TQString KSSLSigners::getCert(TQString subject) { + TQString drc; + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + arg << subject; + bool rc = dcc->call("kded", "kssld", + "caGetCert(TQString)", + data, rettype, retval); + + if (rc && rettype == TQSTRING_OBJECT_NAME_STRING) { + TQDataStream retStream(retval, IO_ReadOnly); + retStream >> drc; + } + +return drc; +} + + +bool KSSLSigners::setUse(TQString subject, bool ssl, bool email, bool code) { + TQByteArray data, retval; + TQCString rettype; + TQDataStream arg(data, IO_WriteOnly); + arg << subject << ssl << email << code; + bool rc = dcc->call("kded", "kssld", + "caSetUse(TQString,bool,bool,bool)", + data, rettype, retval); + + if (rc && rettype == "bool") { + TQDataStream retStream(retval, IO_ReadOnly); + bool drc; + retStream >> drc; + return drc; + } + +return false; +} + + + + |