TDE personal information management applications
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.
 
 
 
 
 
 

120 lines
4.4 KiB

  1. /*
  2. kleo/cryptobackend.h
  3. This file is part of libkleopatra, the KDE keymanagement library
  4. Copyright (c) 2004,2005 Klar�lvdalens Datakonsult AB
  5. Libkleopatra is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the
  8. License, or (at your option) any later version.
  9. Libkleopatra is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  16. In addition, as a special exception, the copyright holders give
  17. permission to link the code of this program with any edition of
  18. the TQt library by Trolltech AS, Norway (or with modified versions
  19. of TQt that use the same license as TQt), and distribute linked
  20. combinations including the two. You must obey the GNU General
  21. Public License in all respects for all of the code used other than
  22. TQt. If you modify this file, you may extend this exception to
  23. your version of the file, but you are not obligated to do so. If
  24. you do not wish to do so, delete this exception statement from
  25. your version.
  26. */
  27. #ifndef __KLEO_CRYPTOBACKEND_H__
  28. #define __KLEO_CRYPTOBACKEND_H__
  29. #include <tqstring.h>
  30. #include <tqvariant.h>
  31. namespace Kleo {
  32. class CryptoConfig;
  33. class KeyListJob;
  34. class KeyGenerationJob;
  35. class ImportJob;
  36. class ExportJob;
  37. class DownloadJob;
  38. class DeleteJob;
  39. class EncryptJob;
  40. class DecryptJob;
  41. class SignJob;
  42. class VerifyDetachedJob;
  43. class VerifyOpaqueJob;
  44. class SignEncryptJob;
  45. class DecryptVerifyJob;
  46. class RefreshKeysJob;
  47. class SpecialJob;
  48. }
  49. namespace Kleo {
  50. class CryptoBackend {
  51. public:
  52. class Protocol;
  53. static const char OpenPGP[];
  54. static const char SMIME[];
  55. virtual ~CryptoBackend() {}
  56. virtual TQString name() const = 0;
  57. virtual TQString displayName() const = 0;
  58. virtual bool checkForOpenPGP( TQString * reason=0 ) const = 0;
  59. virtual bool checkForSMIME( TQString * reason=0 ) const = 0;
  60. virtual bool checkForProtocol( const char * name, TQString * reason=0 ) const = 0;
  61. virtual bool supportsOpenPGP() const = 0;
  62. virtual bool supportsSMIME() const = 0;
  63. virtual bool supportsProtocol( const char * name ) const = 0;
  64. virtual CryptoConfig * config() const = 0;
  65. virtual Protocol * openpgp() const = 0;
  66. virtual Protocol * smime() const = 0;
  67. virtual Protocol * protocol( const char * name ) const = 0;
  68. virtual const char * enumerateProtocols( int i ) const = 0;
  69. };
  70. class CryptoBackend::Protocol {
  71. public:
  72. virtual ~Protocol() {}
  73. virtual TQString name() const = 0;
  74. virtual TQString displayName() const = 0;
  75. virtual KeyListJob * keyListJob( bool remote=false, bool includeSigs=false, bool validate=false ) const = 0;
  76. virtual EncryptJob * encryptJob( bool armor=false, bool textmode=false ) const = 0;
  77. virtual DecryptJob * decryptJob() const = 0;
  78. virtual SignJob * signJob( bool armor=false, bool textMode=false ) const = 0;
  79. virtual VerifyDetachedJob * verifyDetachedJob( bool textmode=false) const = 0;
  80. virtual VerifyOpaqueJob * verifyOpaqueJob( bool textmode=false ) const = 0;
  81. virtual KeyGenerationJob * keyGenerationJob() const = 0;
  82. virtual ImportJob * importJob() const = 0;
  83. virtual ExportJob * publicKeyExportJob( bool armor=false ) const = 0;
  84. // @param charset the encoding of the passphrase in the exported file
  85. virtual ExportJob * secretKeyExportJob( bool armor=false, const TQString& charset = TQString() ) const = 0;
  86. virtual DownloadJob * downloadJob( bool armor=false ) const = 0;
  87. virtual DeleteJob * deleteJob() const = 0;
  88. virtual SignEncryptJob * signEncryptJob( bool armor=false, bool textMode=false ) const = 0;
  89. virtual DecryptVerifyJob * decryptVerifyJob( bool textmode=false ) const = 0;
  90. virtual RefreshKeysJob * refreshKeysJob() const = 0;
  91. virtual SpecialJob * specialJob( const char * type, const TQStringVariantMap & args ) const = 0;
  92. };
  93. }
  94. #endif // __KLEO_CRYPTOBACKEND_H__