File indexing completed on 2024-05-12 15:41:06

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2000-2003 George Staikos <staikos@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef _KSSLSETTINGS_H
0009 #define _KSSLSETTINGS_H
0010 
0011 #include "kiocore_export.h"
0012 
0013 #include <QString>
0014 
0015 #include <KConfig>
0016 
0017 #include <memory>
0018 
0019 class KSSLSettingsPrivate;
0020 
0021 /**
0022  * KDE SSL Settings
0023  *
0024  * This class contains some of the SSL settings for easy use.
0025  *
0026  * @author George Staikos <staikos@kde.org>
0027  * @see KSSL
0028  * @short KDE SSL Settings
0029  */
0030 class KIOCORE_EXPORT KSSLSettings
0031 {
0032 public:
0033     /**
0034      *  Construct a KSSL Settings object
0035      *
0036      *  @param readConfig read in the configuration immediately if true
0037      */
0038     KSSLSettings(bool readConfig = true);
0039 
0040     /**
0041      *  Destroy this KSSL Settings object
0042      */
0043     ~KSSLSettings();
0044 
0045     KSSLSettings(const KSSLSettings &) = delete;
0046     KSSLSettings &operator=(const KSSLSettings &) = delete;
0047 
0048     /**
0049      *  Does the user want to be warned on entering SSL mode
0050      *  @return true if the user wants to be warned
0051      */
0052     bool warnOnEnter() const;
0053 
0054     /**
0055      *  Change the user's warnOnEnter() setting
0056      *  @param x true if the user is to be warned
0057      *  @see warnOnEnter
0058      */
0059     void setWarnOnEnter(bool x);
0060 
0061     /**
0062      *  Does the user want to be warned on sending unencrypted data
0063      *  @return true if the user wants to be warned
0064      *  @see setWarnOnUnencrypted
0065      */
0066     bool warnOnUnencrypted() const;
0067 
0068     /**
0069      *  Change the user's warnOnUnencrypted() setting
0070      *  @param x true if the user is to be warned
0071      *  @see warnOnUnencrypted
0072      */
0073     void setWarnOnUnencrypted(bool x);
0074 
0075     /**
0076      *  Does the user want to be warned on leaving SSL mode
0077      *  @return true if the user wants to be warned
0078      */
0079     bool warnOnLeave() const;
0080 
0081     /**
0082      *  Change the user's warnOnLeave() setting
0083      *  @param x true if the user is to be warned
0084      *  @see warnOnLeave
0085      */
0086     void setWarnOnLeave(bool x);
0087 
0088     /**
0089      *  Does the user want to be warned during mixed SSL/non-SSL mode
0090      *  @return true if the user wants to be warned
0091      */
0092     bool warnOnMixed() const;
0093 
0094     /**
0095      *  Does the user want to use the Entropy Gathering Daemon?
0096      *  @return true if the user wants to use EGD
0097      */
0098     bool useEGD() const;
0099 
0100     /**
0101      *  Does the user want to use an entropy file?
0102      *  @return true if the user wants to use an entropy file
0103      */
0104     bool useEFile() const;
0105 
0106     /**
0107      *  Does the user want X.509 client certificates to always be sent when
0108      *  possible?
0109      *  @return true if the user always wants a certificate sent
0110      */
0111     bool autoSendX509() const;
0112 
0113     /**
0114      *  Does the user want to be prompted to send X.509 client certificates
0115      *  when possible?
0116      *  @return true if the user wants to be prompted
0117      */
0118     bool promptSendX509() const;
0119 
0120     /**
0121      *  Get the OpenSSL cipher list for selecting the list of ciphers to
0122      *  use in a connection.
0123      *  @return the cipher list
0124      */
0125     QString getCipherList();
0126 
0127     /**
0128      *  Get the configured path to the entropy gathering daemon or entropy
0129      *  file.
0130      *  @return the path
0131      */
0132     QString &getEGDPath();
0133 
0134     /**
0135      *  Load the user's settings.
0136      */
0137     void load();
0138 
0139     /**
0140      *  Revert to default settings.
0141      */
0142     void defaults();
0143 
0144     /**
0145      *  Save the current settings.
0146      */
0147     void save();
0148 
0149 private:
0150     std::unique_ptr<KSSLSettingsPrivate> const d;
0151 };
0152 
0153 #endif