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.

173 lines
4.7KB

  1. /* This file is part of the KDE project
  2. *
  3. * Copyright (C) 2001-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 _INCLUDE_KSSLSIGNERS_H
  21. #define _INCLUDE_KSSLSIGNERS_H
  22. class KSSLCertificate;
  23. class DCOPClient;
  24. #include <tqstringlist.h>
  25. #include <tdelibs_export.h>
  26. // ### KDE4 - Fix constness
  27. /**
  28. * KDE SSL Signer Database
  29. *
  30. * This class is used to manipulate the KDE SSL signer database. It
  31. * communicates to the KDE SSL daemon via dcop for backend integration.
  32. *
  33. * @author George Staikos <staikos@kde.org>
  34. * @see KSSL, KSSLCertificate
  35. * @short KDE SSL Signer Database
  36. */
  37. class TDEIO_EXPORT KSSLSigners {
  38. public:
  39. /**
  40. * Construct a KSSLSigner object.
  41. */
  42. KSSLSigners();
  43. /**
  44. * Destroy this KSSLSigner object.
  45. */
  46. ~KSSLSigners();
  47. /**
  48. * Add a signer to the database.
  49. *
  50. * @param cert the signer's certificate
  51. * @param ssl allow it to sign for SSL
  52. * @param email allow it to sign for S/MIME
  53. * @param code allow it to sign for code signing
  54. * @return true on success
  55. */
  56. bool addCA(KSSLCertificate& cert, bool ssl, bool email, bool code);
  57. /**
  58. * Add a signer to the database.
  59. *
  60. * @param cert the signer's certificate in base64 form
  61. * @param ssl allow it to sign for SSL
  62. * @param email allow it to sign for S/MIME
  63. * @param code allow it to sign for code signing
  64. * @return true on success
  65. */
  66. bool addCA(TQString cert, bool ssl, bool email, bool code);
  67. /**
  68. * Regenerate the signer-root file from the user's settings.
  69. * @return true on success
  70. */
  71. bool regenerate();
  72. /**
  73. * Determine if a certificate can be used for SSL certificate signing
  74. * @param cert the certificate
  75. * @return true if it can be used for SSL
  76. */
  77. bool useForSSL(KSSLCertificate& cert);
  78. /**
  79. * Determine if a certificate can be used for SSL certificate signing
  80. * @param subject the certificate subject
  81. * @return true if it can be used for SSL
  82. */
  83. bool useForSSL(TQString subject);
  84. /**
  85. * Determine if a certificate can be used for S/MIME certificate signing
  86. * @param cert the certificate
  87. * @return true if it can be used for S/MIME
  88. */
  89. bool useForEmail(KSSLCertificate& cert);
  90. /**
  91. * Determine if a certificate can be used for S/MIME certificate signing
  92. * @param subject the certificate subject
  93. * @return true if it can be used for S/MIME
  94. */
  95. bool useForEmail(TQString subject);
  96. /**
  97. * Determine if a certificate can be used for code certificate signing
  98. * @param cert the certificate
  99. * @return true if it can be used for code
  100. */
  101. bool useForCode(KSSLCertificate& cert);
  102. /**
  103. * Determine if a certificate can be used for code certificate signing
  104. * @param subject the certificate subject
  105. * @return true if it can be used for code
  106. */
  107. bool useForCode(TQString subject);
  108. /**
  109. * Remove a certificate signer from the database
  110. * @param cert the certificate to remove
  111. * @return true on success
  112. */
  113. bool remove(KSSLCertificate& cert);
  114. /**
  115. * Remove a certificate signer from the database
  116. * @param subject the subject of the certificate to remove
  117. * @return true on success
  118. */
  119. bool remove(TQString subject);
  120. /**
  121. * List the signers in the database.
  122. * @return the list of subjects in the database
  123. * @see getCert
  124. */
  125. TQStringList list();
  126. /**
  127. * Get a signer certificate from the database.
  128. *
  129. * @param subject the subject of the certificate desired
  130. * @return the base64 encoded certificate
  131. */
  132. TQString getCert(TQString subject);
  133. /**
  134. * Set the use of a particular entry in the certificate signer database.
  135. * @param subject the subject of the certificate in question
  136. * @param ssl allow this for SSL certificate signing
  137. * @param email allow this for S/MIME certificate signing
  138. * @param code allow this for code certificate signing
  139. * @return true on success
  140. */
  141. bool setUse(TQString subject, bool ssl, bool email, bool code);
  142. private:
  143. class KSSLSignersPrivate;
  144. KSSLSignersPrivate *d;
  145. DCOPClient *dcc;
  146. };
  147. #endif