KDECore
ksslcertificatemanager_p.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2010 Andreas Hartmetz <ahartmetz@gmail.com> 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., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KSSLCERTIFICATEMANAGER_P_H 00022 #define KSSLCERTIFICATEMANAGER_P_H 00023 00024 #include <QMutex> 00025 00026 #include "kconfig.h" 00027 00028 struct KSslCaCertificate 00029 { 00030 enum Store { 00031 SystemStore = 0, 00032 UserStore 00033 }; 00034 00035 // TODO see if we can get rid of the .toHex() for storage and comparison; requires 00036 // several changes in KSslCertificateManager and CaCertificatesPage! 00037 KSslCaCertificate(const QSslCertificate &c, Store s, bool _isBlacklisted) 00038 : cert(c), 00039 certHash(c.digest().toHex()), 00040 store(s), 00041 isBlacklisted(_isBlacklisted) { } 00042 const QSslCertificate cert; 00043 const QByteArray certHash; 00044 const Store store; 00045 bool isBlacklisted; 00046 // the synthesized version without the const_casts doesn't compile 00047 const KSslCaCertificate &operator=(const KSslCaCertificate &other) 00048 { 00049 const_cast<QSslCertificate &>(cert) = other.cert; 00050 const_cast<QByteArray &>(certHash) = other.certHash; 00051 const_cast<Store &>(store) = other.store; 00052 isBlacklisted = other.isBlacklisted; 00053 return *this; 00054 } 00055 }; 00056 00057 class OrgKdeKSSLDInterface; // aka org::kde::KSSLDInterface 00058 namespace org { namespace kde { 00059 typedef ::OrgKdeKSSLDInterface KSSLDInterface; 00060 }} 00061 00062 class KSslCertificateManagerPrivate 00063 { 00064 public: 00065 KSslCertificateManagerPrivate(); 00066 ~KSslCertificateManagerPrivate(); 00067 00068 static KSslCertificateManagerPrivate *get(KSslCertificateManager *q) 00069 { return q->d; } 00070 00071 void loadDefaultCaCertificates(); 00072 00073 // helpers for setAllCertificates() 00074 bool addCertificate(const KSslCaCertificate &in); 00075 bool removeCertificate(const KSslCaCertificate &old); 00076 bool updateCertificateBlacklisted(const KSslCaCertificate &cert); 00077 bool setCertificateBlacklisted(const QByteArray &certHash, bool isBlacklisted); 00078 00079 void setAllCertificates(const QList<KSslCaCertificate> &certsIn); 00080 QList<KSslCaCertificate> allCertificates() const; 00081 00082 KConfig config; 00083 org::kde::KSSLDInterface *iface; 00084 QHash<QString, KSslError::Error> stringToSslError; 00085 QHash<KSslError::Error, QString> sslErrorToString; 00086 00087 QList<QSslCertificate> defaultCaCertificates; 00088 00089 // for use in setAllCertificates() only 00090 QSet<QByteArray> knownCerts; 00091 QMutex certListMutex; 00092 bool isCertListLoaded; 00093 QString userCertDir; 00094 }; 00095 00096 // don't export KSslCertificateManagerPrivate to avoid unnecessary symbols in libkdecore 00097 KDECORE_EXPORT QList<KSslCaCertificate> _allKsslCaCertificates(KSslCertificateManager *cm); 00098 KDECORE_EXPORT void _setAllKsslCaCertificates(KSslCertificateManager *cm, 00099 const QList<KSslCaCertificate> &certsIn); 00100 00101 #endif //KSSLCERTIFICATEMANAGER_P_H
KDE 4.7 API Reference