1 /***************************************************************************
2 * Copyright (C) 2006 by Petri Damsten *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program 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 *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
26 #include <Q3ValueList>
31 #include <qstringlist.h>
34 @author Petri Damsten <damu@iki.fi>
45 typedef Q3ValueList
< KGpgKey
> KGpgKeyList
;
53 QString
selectKey(QString previous
= QString::null
);
54 KGpgKeyList
keys(bool privateKeys
= false) const;
55 void setText(QString text
, bool saving
) { m_text
= text
; m_saving
= saving
; };
56 void setUseGnuPGAgent(bool use
) { m_useGnuPGAgent
= use
; setPassphraseCb(); };
57 QString
text() const { return m_text
; };
58 bool saving() const { return m_saving
; };
61 bool encrypt(const QByteArray
& inBuffer
, Q_ULONG length
,
62 QByteArray
* outBuffer
, QString keyid
= QString::null
);
63 bool decrypt(const QByteArray
& inBuffer
, QByteArray
* outBuffer
);
65 static QString
checkForUtf8(QString txt
);
66 static bool isGnuPGAgentAvailable();
75 void init(gpgme_protocol_t proto
);
76 gpgme_error_t
readToBuffer(gpgme_data_t in
, QByteArray
* outBuffer
) const;
77 void setPassphraseCb();
78 static gpgme_error_t
passphraseCb(void *hook
, const char *uid_hint
,
79 const char *passphrase_info
,
80 int last_was_bad
, int fd
);
81 gpgme_error_t
passphrase(const char *uid_hint
,
82 const char *passphrase_info
,
83 int last_was_bad
, int fd
);
85 #endif // HAVE_LIBGPGME