certmanager/lib Library API Documentation

cryptplugwrapper.h

Go to the documentation of this file.
00001 
00029 #ifndef cryptplugwrapper_h
00030 #define cryptplugwrapper_h
00031 
00032 #include "cryptplug.h"
00033 
00034 #ifndef LIBKLEOPATRA_NO_COMPAT
00035 
00036 /*
00037  *
00038  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00039  *                                                                        *
00040  *  This file's source comments are optimized for processing by Doxygen.  *
00041  *                                                                        *
00042  *  To obtain best results please get an updated version of Doxygen,      *
00043  *  for sources and binaries goto http://www.doxygen.org/index.html       *
00044  *                                                                        *
00045   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00046 
00047                                                                           *
00048                                                                           */
00049 #include <kdemacros.h>
00050 
00051 #include "kleo/cryptobackend.h"
00052 
00053 #include <qdatetime.h>
00054 
00055 #include <qvaluelist.h>
00056 #include <qpair.h>
00057 #include <qstringlist.h>
00058 #include <qstring.h>
00059 
00060 
00061 class KConfigBase;
00062 class QGpgMECryptoConfig;
00063 
00064 namespace GpgME {
00065   class ImportResult;
00066   class KeyGenerationResult;
00067 }
00068 
00069 namespace Kleo {
00070   class KeyListJob;
00071   class EncryptJob;
00072   class DecryptJob;
00073   class SignJob;
00074   class VerifyDetachedJob;
00075   class VerifyOpaqueJob;
00076   class KeyGenerationJob;
00077   class ImportJob;
00078   class ExportJob;
00079   class DownloadJob;
00080   class DeleteJob;
00081   class SignEncryptJob;
00082   class DecryptVerifyJob;
00083   class CryptoConfig;
00084   class RefreshKeysJob;
00085   class SpecialJob;
00086 }
00087 
00228 class CryptPlugWrapper;
00436 class StructuringInfoWrapper {
00437 public:
00438   StructuringInfoWrapper( CryptPlugWrapper* wrapper );
00439   ~StructuringInfoWrapper();
00440   void reset();
00441   CryptPlug::StructuringInfo data;
00442 private:
00443   void initMe();
00444   void freeMe();
00445   bool _initDone;
00446   CryptPlugWrapper* _wrapper;
00447 };
00448 
00449 
00450 
00454 class CryptPlugWrapper : public Kleo::CryptoBackend::Protocol {
00455 public:
00456     static QString errorIdToText( int errId, bool & isPassphraseError );
00457 
00468     typedef enum {
00469         InitStatus_undef         = 0,
00470 
00471         InitStatus_Ok            = 1,
00472         InitStatus_NoLibName     = 2,
00473         InitStatus_LoadError     = 0x1000,
00474         InitStatus_InitError     = 0x2000
00475     } InitStatus;
00476 
00502     enum {
00503         SigStatus_UNKNOWN     = 0x0000,
00504         SigStatus_VALID       = SigStat_VALID,
00505         SigStatus_GREEN       = SigStat_GREEN,
00506         SigStatus_RED         = SigStat_RED,
00507         SigStatus_KEY_REVOKED = SigStat_KEY_REVOKED,
00508         SigStatus_KEY_EXPIRED = SigStat_KEY_EXPIRED,
00509         SigStatus_SIG_EXPIRED = SigStat_SIG_EXPIRED,
00510         SigStatus_KEY_MISSING = SigStat_KEY_MISSING,
00511         SigStatus_CRL_MISSING = SigStat_CRL_MISSING,
00512         SigStatus_CRL_TOO_OLD = SigStat_CRL_TOO_OLD,
00513         SigStatus_BAD_POLICY  = SigStat_BAD_POLICY,
00514         SigStatus_SYS_ERROR   = SigStat_SYS_ERROR,
00515 
00516         SigStatus_NUMERICAL_CODE = 0x8000 /* An other error occurred. */
00517     };
00518     typedef unsigned long SigStatusFlags;
00519 
00520 
00521     enum {
00522         CertStatus_EXPIRES_NEVER = CRYPTPLUG_CERT_DOES_NEVER_EXPIRE
00523     };
00524 
00525 
00552     CryptPlugWrapper( const QString& name=QString::null,
00553                       const QString& libName=QString::null,
00554                       const QString& update=QString::null,
00555                       bool           active = false );
00556 
00566     ~CryptPlugWrapper();
00567 
00568     QString protocol() const;
00569 
00570     QString name() const {
00571       return protocol();
00572     }
00573 
00599     void setActive( bool active );
00600 
00608     bool active() const;
00609 
00610 
00635     bool setLibName( const QString& libName );
00636 
00645     QString libName() const;
00646 
00647 
00652     void setDisplayName( const QString& name );
00653 
00654 
00659     QString displayName() const;
00660 
00661 private:
00679     bool initialize( InitStatus* initStatus, QString* errorMsg );
00680 
00681 public:
00694     void deinitialize();
00695 
00708     InitStatus initStatus( QString* errorMsg ) const;
00709 
00710 
00725     bool hasFeature( Feature );
00726 
00727 
00728     /* \ingroup groupSignAct
00729      * Frees the members of a signature meta data struct, but not the
00730      * signature meta data struct itself as this could be allocated on
00731      * the stack.
00732      */
00733     void freeSignatureMetaData( CryptPlug::SignatureMetaData* );
00734 
00756     bool checkMessageSignature( char** cleartext,
00757                                 const char* signaturetext,
00758                                 bool signatureIsBinary,
00759                                 int signatureLen,
00760                                 CryptPlug::SignatureMetaData* sigmeta );
00761 
00772     bool decryptMessage( const char* ciphertext,
00773                          bool        cipherIsBinary,
00774                          int         cipherLen,
00775                          char**      cleartext,
00776                          const char* certificate,
00777                          int* errId,
00778                          char** errTxt );
00779 
00792     bool decryptAndCheckMessage( const char*  ciphertext,
00793                                  bool         cipherIsBinary,
00794                                  int          cipherLen,
00795                                  char**       cleartext,
00796                                  const char*  certificate,
00797                                  bool*        signatureFound,
00798                                  CryptPlug::SignatureMetaData* sigmeta,
00799                                  int*   errId,
00800                                  char** errTxt );
00801 
00802     Kleo::KeyListJob * keyListJob( bool remote=false, bool includeSigs=false, bool validate=true ) const;
00803     Kleo::EncryptJob * encryptJob( bool armor=false, bool textmode=false ) const;
00804     Kleo::DecryptJob * decryptJob() const;
00805     Kleo::SignJob * signJob( bool armor=false, bool textMode=false ) const;
00806     Kleo::VerifyDetachedJob * verifyDetachedJob( bool textmode=false) const;
00807     Kleo::VerifyOpaqueJob * verifyOpaqueJob( bool textmode=false ) const;
00808     Kleo::KeyGenerationJob * keyGenerationJob() const;
00809 
00810     Kleo::ImportJob * importJob() const;
00811     Kleo::ExportJob * publicKeyExportJob( bool armor=false ) const;
00812     Kleo::ExportJob * secretKeyExportJob( bool armor=false, const QString& charset = QString::null ) const;
00813     Kleo::DownloadJob * downloadJob( bool armor=false ) const;
00814     Kleo::DeleteJob * deleteJob() const;
00815 
00816     Kleo::SignEncryptJob * signEncryptJob( bool armor=false, bool textmode=false ) const;
00817     Kleo::DecryptVerifyJob * decryptVerifyJob( bool textmode=false ) const;
00818     Kleo::RefreshKeysJob * refreshKeysJob() const;
00819 
00820     Kleo::SpecialJob * specialJob( const char *, const QMap<QString,QVariant> & ) const { return 0; }
00821 
00822     GpgME::ImportResult importCertificate( const char* data, size_t length );
00823 
00824     CryptPlug * cryptPlug() const { return _cp; }
00825 
00826 private:
00827     QString    _name;
00828     QString    _libName;
00829     QString    _updateURL;
00830     bool       _active;
00831     InitStatus _initStatus;
00832     QString    _lastError;
00833     CryptPlug* _cp;
00834     // local parameters without representation in cryptplug.h
00835     bool mAlwaysEncryptToSelf;
00836     class Config;
00837     Config * _config;
00838     QGpgMECryptoConfig * _cryptoConfig;
00839 };
00840 
00841 #endif // !LIBKLEOPATRA_NO_COMPAT
00842 
00843 #endif // cryptplugwrapper_h
KDE Logo
This file is part of the documentation for certmanager/lib Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 4 14:40:31 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003