File: licq_gpg.h

package info (click to toggle)
licq 1.3.4-2etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 22,052 kB
  • ctags: 8,640
  • sloc: cpp: 76,924; sh: 9,845; ansic: 5,424; perl: 3,449; lex: 857; xml: 804; php: 691; makefile: 393; csh: 48
file content (48 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

#ifndef _LICQ_GPG_H_INCLUDED_
#define _LICQ_GPG_H_INCLUDED_

#ifdef HAVE_LIBGPGME
#include <gpgme.h>
#endif
#include <pthread.h>

class CGPGHelper
{
public:
  static const char pgpSig[];
  CGPGHelper();
  ~CGPGHelper();
  char *Decrypt(const char *);
  char *Encrypt(const char *, const char *, unsigned long);
  void Start();

protected:
  CIniFile mKeysIni;
#ifdef HAVE_LIBGPGME
  gpgme_ctx_t mCtx;
#endif
  char *mGPGPassphrase;

  void gpgmeLock();
  void gpgmeUnlock();
#ifdef HAVE_LIBGPGME
  static gpgme_error_t PassphraseCallback(void *, const char *, const char*, int, int);
#endif
};

class CGPGMEMutex
{
public:
  ~CGPGMEMutex();
  CGPGMEMutex();
  bool Lock();

protected:
  static pthread_mutex_t mutex;
};


extern CGPGHelper gGPGHelper;

#endif //_LICQ_GPG_H_INCLUDED_