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.

91 lines
3.2KB

  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 _KSSLCERTIFICATEHOME_H
  21. #define _KSSLCERTIFICATEHOME_H
  22. class KSSLCertificate;
  23. class KSSLPKCS12;
  24. #include <tqstring.h>
  25. #include <tqstringlist.h>
  26. #include <tdelibs_export.h>
  27. class TDEIO_EXPORT KSSLCertificateHome {
  28. public:
  29. // AuthNone means there is no policy. AuthDont means _don't_ _send_!!
  30. enum KSSLAuthAction {AuthNone, AuthSend, AuthPrompt, AuthDont};
  31. /*
  32. * These methods might dynamically allocate an object for you. Be sure
  33. * to delete them when you are done.
  34. */
  35. static KSSLPKCS12* getCertificateByHost(TQString host, TQString password, KSSLAuthAction* aa);
  36. static KSSLPKCS12* getCertificateByName(TQString name, TQString password);
  37. static KSSLPKCS12* getCertificateByName(TQString name);
  38. static TQString getDefaultCertificateName(TQString host, KSSLAuthAction *aa = NULL);
  39. static TQString getDefaultCertificateName(KSSLAuthAction *aa = NULL);
  40. static KSSLPKCS12* getDefaultCertificate(TQString password, KSSLAuthAction *aa = NULL);
  41. static KSSLPKCS12* getDefaultCertificate(KSSLAuthAction *aa = NULL);
  42. static bool hasCertificateByName(TQString name);
  43. /*
  44. * These set the default certificate for hosts without a policy.
  45. */
  46. static void setDefaultCertificate(TQString name, bool send = true, bool prompt = false);
  47. static void setDefaultCertificate(KSSLPKCS12 *cert, bool send = true, bool prompt = false);
  48. /*
  49. * These set the default certificate for a host.
  50. */
  51. static void setDefaultCertificate(TQString name, TQString host, bool send = true, bool prompt = false);
  52. static void setDefaultCertificate(KSSLPKCS12 *cert, TQString host, bool send = true, bool prompt = false);
  53. /*
  54. * These add a certificate to the repository.
  55. * Returns: true on success, false error
  56. */
  57. static bool addCertificate(TQString filename, TQString password, bool storePass = false);
  58. static bool addCertificate(KSSLPKCS12 *cert, TQString passToStore = TQString::null);
  59. /*
  60. * These deletes a certificate from the repository.
  61. * Returns: true on success, false error
  62. */
  63. static bool deleteCertificate(const TQString &filename, const TQString &password);
  64. static bool deleteCertificate(KSSLPKCS12 *cert);
  65. static bool deleteCertificateByName(const TQString &name);
  66. /*
  67. * Returns the list of certificates available
  68. */
  69. static TQStringList getCertificateList();
  70. private:
  71. class KSSLCertificateHomePrivate;
  72. KSSLCertificateHomePrivate *d;
  73. };
  74. #endif