TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ksslsettings.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /* This file is part of the KDE project
  2. *
  3. * Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this library; see the file COPYING.LIB. If not, write to
  17. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef _KSSLSETTINGS_H
  21. #define _KSSLSETTINGS_H
  22. #include <tqstring.h>
  23. #include <tqvaluelist.h>
  24. #include <tdeconfig.h>
  25. class KSSLSettingsPrivate;
  26. /**
  27. * KDE SSL Settings
  28. *
  29. * This class contains some of the SSL settings for easy use.
  30. *
  31. * @author George Staikos <staikos@kde.org>
  32. * @see KSSL
  33. * @short KDE SSL Settings
  34. */
  35. class TDEIO_EXPORT KSSLSettings {
  36. public:
  37. /**
  38. * Construct a KSSL Settings object
  39. *
  40. * @param readConfig read in the configuration immediately if true
  41. */
  42. KSSLSettings(bool readConfig = true);
  43. /**
  44. * Destroy this KSSL Settings object
  45. */
  46. ~KSSLSettings();
  47. /**
  48. * Does the user allow SSLv2
  49. * @return true if the user allows SSLv2
  50. */
  51. bool sslv2() const;
  52. /**
  53. * Does the user allow SSLv3
  54. * @return true if the user allows SSLv3
  55. */
  56. bool sslv3() const;
  57. /**
  58. * Does the user allow TLSv1
  59. * @return true if the user allows TLSv1
  60. */
  61. bool tlsv1() const;
  62. /**
  63. * Does the user want to be warned on entering SSL mode
  64. * @return true if the user wants to be warned
  65. */
  66. bool warnOnEnter() const;
  67. /**
  68. * Change the user's warnOnEnter() setting
  69. * @since 3.3
  70. * @param x true if the user is to be warned
  71. * @see warnOnEnter
  72. */
  73. void setWarnOnEnter(bool x);
  74. /**
  75. * Does the user want to be warned on sending unencrypted data
  76. * @return true if the user wants to be warned
  77. * @see setWarnOnUnencrypted
  78. */
  79. bool warnOnUnencrypted() const;
  80. /**
  81. * Change the user's warnOnUnencrypted() setting
  82. * @param x true if the user is to be warned
  83. * @see warnOnUnencrypted
  84. */
  85. void setWarnOnUnencrypted(bool x);
  86. /**
  87. * Does the user want to be warned on leaving SSL mode
  88. * @return true if the user wants to be warned
  89. */
  90. bool warnOnLeave() const;
  91. /**
  92. * Change the user's warnOnLeave() setting
  93. * @since 3.3
  94. * @param x true if the user is to be warned
  95. * @see warnOnLeave
  96. */
  97. void setWarnOnLeave(bool x);
  98. /**
  99. * Does the user want to be warned during mixed SSL/non-SSL mode
  100. * @return true if the user wants to be warned
  101. */
  102. bool warnOnMixed() const;
  103. /**
  104. * Do not use this
  105. * @deprecated
  106. */
  107. bool warnOnSelfSigned() const KDE_DEPRECATED;
  108. /**
  109. * Do not use this
  110. * @deprecated
  111. */
  112. bool warnOnRevoked() const KDE_DEPRECATED;
  113. /**
  114. * Do not use this
  115. * @deprecated
  116. */
  117. bool warnOnExpired() const KDE_DEPRECATED;
  118. /**
  119. * Does the user want to use the Entropy Gathering Daemon?
  120. * @return true if the user wants to use EGD
  121. */
  122. bool useEGD() const;
  123. /**
  124. * Does the user want to use an entropy file?
  125. * @return true if the user wants to use an entropy file
  126. */
  127. bool useEFile() const;
  128. /**
  129. * Change the user's TLSv1 preference
  130. * @param enabled true if TLSv1 is enabled
  131. */
  132. void setTLSv1(bool enabled);
  133. /**
  134. * Change the user's SSLv2 preference
  135. * @param enabled true if SSLv2 is enabled
  136. */
  137. void setSSLv2(bool enabled);
  138. /**
  139. * Change the user's SSLv3 preference
  140. * @param enabled true if SSLv3 is enabled
  141. */
  142. void setSSLv3(bool enabled);
  143. /**
  144. * Does the user want X.509 client certificates to always be sent when
  145. * possible?
  146. * @return true if the user always wants a certificate sent
  147. */
  148. bool autoSendX509() const;
  149. /**
  150. * Does the user want to be prompted to send X.509 client certificates
  151. * when possible?
  152. * @return true if the user wants to be prompted
  153. */
  154. bool promptSendX509() const;
  155. /**
  156. * Get the OpenSSL cipher list for selecting the list of ciphers to
  157. * use in a connection.
  158. * @return the cipher list
  159. */
  160. TQString getCipherList();
  161. /**
  162. * Get the configured path to the entropy gathering daemon or entropy
  163. * file.
  164. * @return the path
  165. */
  166. TQString& getEGDPath();
  167. /**
  168. * Load the user's settings.
  169. */
  170. void load();
  171. /**
  172. * Revert to default settings.
  173. */
  174. void defaults();
  175. /**
  176. * Save the current settings.
  177. */
  178. void save();
  179. private:
  180. TDEConfig *m_cfg;
  181. bool m_bUseSSLv2, m_bUseSSLv3, m_bUseTLSv1;
  182. bool m_bWarnOnEnter, m_bWarnOnUnencrypted, m_bWarnOnLeave, m_bWarnOnMixed;
  183. bool m_bWarnSelfSigned, m_bWarnRevoked, m_bWarnExpired;
  184. TQValueList<TQString> v2ciphers, v2selectedciphers, v3ciphers, v3selectedciphers;
  185. TQValueList<int> v2bits, v3bits;
  186. KSSLSettingsPrivate *d;
  187. };
  188. #endif