kio Library API Documentation

kssld.h

00001 /*
00002    This file is part of the KDE libraries
00003 
00004    Copyright (c) 2001-2005 George Staikos <staikos@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.
00020 
00021 */
00022 #ifndef __KSSLD_H__
00023 #define __KSSLD_H__
00024 
00025 #include <kded/kdedmodule.h>
00026 #include <ksslcertificate.h>
00027 #include <ksslcertificatecache.h>
00028 #include <qstring.h>
00029 #include <qstringlist.h>
00030 #include <qvaluelist.h>
00031 #include <qmap.h>
00032 #include <qptrvector.h>
00033 
00034 
00035 class KSimpleConfig;
00036 class KSSLCNode;
00037 class KOpenSSLProxy;
00038 
00039 class KSSLD : public KDEDModule
00040 {
00041   Q_OBJECT
00042   K_DCOP
00043 
00044 public:
00045   
00046   KSSLD(const QCString &name);
00047   
00048   virtual ~KSSLD();
00049 
00050 k_dcop:
00051   //
00052   //  Certificate Cache methods
00053   //
00054   void cacheAddCertificate(KSSLCertificate cert, 
00055                    KSSLCertificateCache::KSSLCertificatePolicy policy,
00056                    bool permanent = true);
00057   KSSLCertificateCache::KSSLCertificatePolicy cacheGetPolicyByCN(QString cn);
00058 
00059   KSSLCertificateCache::KSSLCertificatePolicy cacheGetPolicyByCertificate(KSSLCertificate cert);
00060 
00061   bool cacheSeenCN(QString cn);
00062   bool cacheSeenCertificate(KSSLCertificate cert);
00063 
00064   bool cacheRemoveByCN(QString cn);
00065   bool cacheRemoveBySubject(QString subject);
00066   bool cacheRemoveByCertificate(KSSLCertificate cert);
00067            
00068   bool cacheIsPermanent(KSSLCertificate cert);
00069 
00070   void cacheReload();
00071 
00072   bool cacheModifyByCN(QString cn,
00073                        KSSLCertificateCache::KSSLCertificatePolicy policy,
00074                        bool permanent,
00075                        QDateTime expires);
00076 
00077   bool cacheModifyByCertificate(KSSLCertificate cert,
00078                            KSSLCertificateCache::KSSLCertificatePolicy policy,
00079                                 bool permanent,
00080                                 QDateTime expires);
00081 
00082   QStringList cacheGetHostList(KSSLCertificate cert);
00083 
00084   bool cacheAddHost(KSSLCertificate cert, QString host);
00085 
00086   bool cacheRemoveHost(KSSLCertificate cert, QString host);
00087 
00088   /* Certificate Authorities */
00089   void caVerifyUpdate();
00090   bool caRegenerate();
00091 
00092   QStringList caList();
00093 
00094   bool caUseForSSL(QString subject);
00095 
00096   bool caUseForEmail(QString subject);
00097   
00098   bool caUseForCode(QString subject);
00099 
00100   bool caAdd(QString certificate, bool ssl, bool email, bool code);
00101 
00102   bool caAddFromFile(QString filename, bool ssl, bool email, bool code);
00103 
00104   bool caRemove(QString subject);
00105 
00106   bool caRemoveFromFile(QString filename);
00107 
00108   QString caGetCert(QString subject);
00109 
00110   bool caSetUse(QString subject, bool ssl, bool email, bool code);
00111 
00112   QStringList getKDEKeyByEmail(const QString &email);
00113 
00114   KSSLCertificate getCertByMD5Digest(const QString &key);
00115 
00116   //
00117   //  Certificate Home methods
00118   //
00119 
00120   QStringList getHomeCertificateList();
00121 
00122   bool addHomeCertificateFile(QString filename, QString password, bool storePass /*=false*/);
00123 
00124   bool addHomeCertificatePKCS12(QString base64cert, QString passToStore);
00125 
00126   bool deleteHomeCertificateByFile(QString filename, QString password);
00127 
00128   bool deleteHomeCertificateByPKCS12(QString base64cert, QString password);
00129 
00130   bool deleteHomeCertificateByName(QString name);
00131 
00132 private:
00133 
00134   void cacheClearList();
00135   void cacheSaveToDisk();
00136   void cacheLoadDefaultPolicies();
00137 
00138   // for the cache portion:
00139   KSimpleConfig *cfg;
00140   QPtrList<KSSLCNode> certList;
00141 
00142   // Our pointer to OpenSSL
00143   KOpenSSLProxy *kossl;
00144 
00145   // 
00146   void searchAddCert(KSSLCertificate *cert);
00147   void searchRemoveCert(KSSLCertificate *cert);
00148 
00149   QMap<QString, QPtrVector<KSSLCertificate> > skEmail;
00150   QMap<QString, KSSLCertificate *> skMD5Digest;
00151 };
00152 
00153 
00154 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Jun 12 11:35:25 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003