File indexing completed on 2023-05-30 09:18:40

0001 /* This file is part of the KDE project
0002  *
0003  * Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #ifndef _KSSLSETTINGS_H
0022 #define _KSSLSETTINGS_H
0023 
0024 #include <kio/kio_export.h>
0025 
0026 #include <QtCore/QString>
0027 
0028 #include <kconfig.h>
0029 
0030 class KSSLSettingsPrivate;
0031 
0032 /**
0033  * KDE SSL Settings
0034  *
0035  * This class contains some of the SSL settings for easy use.
0036  *
0037  * @author George Staikos <staikos@kde.org>
0038  * @see KSSL
0039  * @short KDE SSL Settings
0040  */
0041 class KIO_EXPORT KSSLSettings {
0042 public:
0043     /**
0044      *  Construct a KSSL Settings object
0045      *
0046      *  @param readConfig read in the configuration immediately if true
0047      */
0048     KSSLSettings(bool readConfig = true);
0049 
0050     /**
0051      *  Destroy this KSSL Settings object
0052      */
0053     ~KSSLSettings();
0054 
0055     /**
0056      *  Does the user want to be warned on entering SSL mode
0057      *  @return true if the user wants to be warned
0058      */
0059     bool warnOnEnter() const;
0060 
0061     /**
0062      *  Change the user's warnOnEnter() setting
0063      *  @param x true if the user is to be warned
0064      *  @see warnOnEnter
0065      */
0066     void setWarnOnEnter(bool x);
0067     
0068     /**
0069      *  Does the user want to be warned on sending unencrypted data
0070      *  @return true if the user wants to be warned
0071      *  @see setWarnOnUnencrypted
0072      */
0073     bool warnOnUnencrypted() const;
0074 
0075     /**
0076      *  Change the user's warnOnUnencrypted() setting
0077      *  @param x true if the user is to be warned
0078      *  @see warnOnUnencrypted
0079      */
0080     void setWarnOnUnencrypted(bool x);
0081 
0082     /**
0083      *  Does the user want to be warned on leaving SSL mode
0084      *  @return true if the user wants to be warned
0085      */
0086     bool warnOnLeave() const;
0087 
0088     /**
0089      *  Change the user's warnOnLeave() setting
0090      *  @param x true if the user is to be warned
0091      *  @see warnOnLeave
0092      */
0093     void setWarnOnLeave(bool x);
0094     
0095     /**
0096      *  Does the user want to be warned during mixed SSL/non-SSL mode
0097      *  @return true if the user wants to be warned
0098      */
0099     bool warnOnMixed() const;
0100 
0101     /**
0102      *  Does the user want to use the Entropy Gathering Daemon?
0103      *  @return true if the user wants to use EGD
0104      */
0105     bool useEGD() const;
0106 
0107     /**
0108      *  Does the user want to use an entropy file?
0109      *  @return true if the user wants to use an entropy file
0110      */
0111     bool useEFile() const;
0112   
0113     /**
0114      *  Does the user want X.509 client certificates to always be sent when
0115      *  possible?
0116      *  @return true if the user always wants a certificate sent
0117      */
0118     bool autoSendX509() const;
0119 
0120     /**
0121      *  Does the user want to be prompted to send X.509 client certificates
0122      *  when possible?
0123      *  @return true if the user wants to be prompted
0124      */
0125     bool promptSendX509() const;
0126 
0127     /**
0128      *  Get the OpenSSL cipher list for selecting the list of ciphers to
0129      *  use in a connection.
0130      *  @return the cipher list
0131      */
0132     QString getCipherList();
0133 
0134     /**
0135      *  Get the configured path to the entropy gathering daemon or entropy
0136      *  file.
0137      *  @return the path
0138      */
0139     QString& getEGDPath();
0140 
0141     /**
0142      *  Load the user's settings.
0143      */
0144     void load();
0145 
0146     /**
0147      *  Revert to default settings.
0148      */
0149     void defaults();
0150 
0151     /**
0152      *  Save the current settings.
0153      */
0154     void save();
0155 
0156 private:
0157     KConfig *m_cfg;
0158     bool m_bWarnOnEnter, m_bWarnOnUnencrypted, m_bWarnOnLeave, m_bWarnOnMixed;
0159     bool m_bWarnSelfSigned, m_bWarnRevoked, m_bWarnExpired;
0160 
0161     QList<QString> v3ciphers, v3selectedciphers;
0162     QList<int> v3bits;
0163 
0164     KSSLSettingsPrivate* const d;
0165 };
0166 
0167 
0168 #endif
0169