connwrap - initialize gnutls session in cw_connect
[centerim.git] / src / impgp.h
blob429b081f6f50ebd450c0310c82b4bcd50942a33b
1 #ifndef __IMPGP_H__
2 #define __IMPGP_H__
4 #include "icqcommon.h"
6 #ifdef HAVE_GPGME
8 #include "imcontact.h"
10 #include <gpgme.h>
12 class impgp {
13 private:
14 gpgme_ctx_t ctx;
16 static protocolname opname;
17 static string passphrase[protocolname_size];
19 void strip(string &r);
21 static gpgme_error_t passphrase_cb(void *hook, const char *uidhint,
22 const char *info, int prevbad, int fd);
24 public:
25 impgp();
26 ~impgp();
28 vector<string> getkeys(bool secretonly = false);
29 string getkeyinfo(const string &fp, bool secret);
30 bool havekey(const string &keyid) const;
32 string sign(const string &text, const string &keyid, protocolname pname);
33 string verify(string sign, const string &orig);
35 string decrypt(string text, protocolname pname);
36 string encrypt(const string &text, const string &keyid, protocolname pname);
38 bool enabled(protocolname p) const;
39 bool enabled(const imcontact &ic) const;
41 void clearphrase(protocolname p);
44 extern impgp pgp;
46 #endif
48 #endif