aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-05-15 14:20:04 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-05-15 14:20:04 +0000
commitba29e3245d916022ebe36bc9070ee616d39e6b1d (patch)
tree6e3f8529cd4a131bc05a3039a88c529b05fc967f
parentadd attachmnet-view to view-menu (diff)
downloadgpg4usb-ba29e3245d916022ebe36bc9070ee616d39e6b1d.tar.gz
gpg4usb-ba29e3245d916022ebe36bc9070ee616d39e6b1d.zip
astyle code beautyfying
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@336 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--attachments.cpp8
-rw-r--r--attachmenttablemodel.cpp63
-rw-r--r--context.cpp42
-rw-r--r--context.h10
-rwxr-xr-xfileencryptiondialog.cpp28
-rw-r--r--gpgwin.cpp171
-rw-r--r--gpgwin.h2
-rw-r--r--keydetailsdialog.cpp121
-rw-r--r--keydetailsdialog.h32
-rw-r--r--keylist.cpp16
-rwxr-xr-xkeymgmt.cpp75
-rwxr-xr-xkeymgmt.h2
-rw-r--r--main.cpp8
-rw-r--r--mime.cpp209
-rw-r--r--mime.h45
-rwxr-xr-xsettingsdialog.cpp234
-rwxr-xr-xsettingsdialog.h56
-rw-r--r--winbuild/include/gpg-error.h90
-rw-r--r--winbuild/include/gpgme.h1345
19 files changed, 1262 insertions, 1295 deletions
diff --git a/attachments.cpp b/attachments.cpp
index ad56540..d25db21 100644
--- a/attachments.cpp
+++ b/attachments.cpp
@@ -90,7 +90,7 @@ void Attachments::saveFile()
QString filename = mp.getParam("Content-Type", "name");
// TODO: find out why filename is quoted
filename.chop(1);
- filename.remove(0,1);
+ filename.remove(0, 1);
// TODO: check if really base64
saveByteArrayToFile(QByteArray::fromBase64(mp.body), filename);
@@ -100,10 +100,10 @@ void Attachments::saveByteArrayToFile(QByteArray outBuffer, QString filename)
{
//QString path="";
- QString path=filename;
+ QString path = filename;
QString outfileName = QFileDialog::getSaveFileName(this, tr("Save File"), path);
- if(outfileName.isEmpty()) return;
+ if (outfileName.isEmpty()) return;
QFile outfile(outfileName);
if (!outfile.open(QFile::WriteOnly)) {
@@ -122,6 +122,6 @@ void Attachments::saveByteArrayToFile(QByteArray outBuffer, QString filename)
void Attachments::addMimePart(MimePart *mp)
{
- table->add(*mp);
+ table->add(*mp);
}
diff --git a/attachmenttablemodel.cpp b/attachmenttablemodel.cpp
index 8aac394..2ef3821 100644
--- a/attachmenttablemodel.cpp
+++ b/attachmenttablemodel.cpp
@@ -4,38 +4,41 @@
*/
AttachmentTableModel::AttachmentTableModel(QObject *parent) :
- QAbstractTableModel(parent)
+ QAbstractTableModel(parent)
{
}
AttachmentTableModel::AttachmentTableModel(QList<MimePart> mimeparts, QObject *parent) :
- QAbstractTableModel(parent)
+ QAbstractTableModel(parent)
{
listOfMimeparts = mimeparts;
}
AttachmentTableModel::AttachmentTableModel(QString iconpath, QObject *parent) :
- QAbstractTableModel(parent)
+ QAbstractTableModel(parent)
{
iconPath = iconpath;
}
-void AttachmentTableModel::add(MimePart mp) {
- listOfMimeparts.append(mp);
- //QModelIndex changedIndex0 = createIndex(listOfMimeparts.size(), 0);
- //QModelIndex changedIndex1 = createIndex(listOfMimeparts.size(), 1);
+void AttachmentTableModel::add(MimePart mp)
+{
+ listOfMimeparts.append(mp);
+ //QModelIndex changedIndex0 = createIndex(listOfMimeparts.size(), 0);
+ //QModelIndex changedIndex1 = createIndex(listOfMimeparts.size(), 1);
- //emit(dataChanged(changedIndex0, changedIndex1));
- // TODO: check the data-changed signal
- reset();
+ //emit(dataChanged(changedIndex0, changedIndex1));
+ // TODO: check the data-changed signal
+ reset();
}
-MimePart AttachmentTableModel::getSelectedMimePart(QModelIndex index){
+MimePart AttachmentTableModel::getSelectedMimePart(QModelIndex index)
+{
return listOfMimeparts.at(index.row());
}
-MimePart AttachmentTableModel::getMimePart(int index){
+MimePart AttachmentTableModel::getMimePart(int index)
+{
return listOfMimeparts.at(index);
}
@@ -54,10 +57,10 @@ int AttachmentTableModel::rowCount(const QModelIndex &parent) const
}
int AttachmentTableModel::columnCount(const QModelIndex &parent) const
- {
- Q_UNUSED(parent);
- return 2;
- }
+{
+ Q_UNUSED(parent);
+ return 2;
+}
QVariant AttachmentTableModel::data(const QModelIndex &index, int role) const
{
@@ -85,14 +88,14 @@ QVariant AttachmentTableModel::data(const QModelIndex &index, int role) const
if (role == Qt::DecorationRole && index.column() == 0) {
MimePart mp = listOfMimeparts.at(index.row());
QString icon;
- if(mp.getValue("Content-Type").startsWith("image")) {
- icon = iconPath + "/mimetypes/image-x-generic.png";
- } else {
- icon = mp.getValue("Content-Type").replace("/", "-");
- icon = iconPath + "/mimetypes/" + icon + ".png";
- }
- if(!QFile::exists(icon)) icon = iconPath + "/mimetypes/unknown.png";
- return QIcon(icon);
+ if (mp.getValue("Content-Type").startsWith("image")) {
+ icon = iconPath + "/mimetypes/image-x-generic.png";
+ } else {
+ icon = mp.getValue("Content-Type").replace("/", "-");
+ icon = iconPath + "/mimetypes/" + icon + ".png";
+ }
+ if (!QFile::exists(icon)) icon = iconPath + "/mimetypes/unknown.png";
+ return QIcon(icon);
}
return QVariant();
@@ -106,14 +109,14 @@ QVariant AttachmentTableModel::headerData(int section, Qt::Orientation orientati
if (orientation == Qt::Horizontal) {
switch (section) {
- case 0:
- return tr("Filename");
+ case 0:
+ return tr("Filename");
- case 1:
- return tr("Contenttype");
+ case 1:
+ return tr("Contenttype");
- default:
- return QVariant();
+ default:
+ return QVariant();
}
}
return QVariant();
diff --git a/context.cpp b/context.cpp
index a737b11..09e4e57 100644
--- a/context.cpp
+++ b/context.cpp
@@ -65,9 +65,9 @@ Context::Context()
QString gpgBin = appPath + "/bin/gpg";
#endif
QString gpgKeys = appPath + "/keydb";
-/* err = gpgme_ctx_set_engine_info(mCtx, GPGME_PROTOCOL_OpenPGP,
- gpgBin.toUtf8().constData(),
- gpgKeys.toUtf8().constData());*/
+ /* err = gpgme_ctx_set_engine_info(mCtx, GPGME_PROTOCOL_OpenPGP,
+ gpgBin.toUtf8().constData(),
+ gpgKeys.toUtf8().constData());*/
err = gpgme_ctx_set_engine_info(mCtx, GPGME_PROTOCOL_OpenPGP,
gpgBin.toLocal8Bit().constData(),
gpgKeys.toLocal8Bit().constData());
@@ -152,18 +152,18 @@ bool Context::exportKeys(QStringList *uidList, QByteArray *outBuffer)
return true;
}
-gpgme_key_t Context::getKeyDetails(QString uid)
+gpgme_key_t Context::getKeyDetails(QString uid)
{
- gpgme_key_t key;
+ gpgme_key_t key;
// try secret
- gpgme_get_key (mCtx, uid.toAscii().constData(), &key, 1);
+ gpgme_get_key(mCtx, uid.toAscii().constData(), &key, 1);
// ok, its a public key
- if(!key) {
- gpgme_get_key (mCtx, uid.toAscii().constData(), &key, 0);
+ if (!key) {
+ gpgme_get_key(mCtx, uid.toAscii().constData(), &key, 0);
}
-
- return key;
+
+ return key;
}
/** List all availabe Keys (VERY much like kgpgme)
@@ -448,30 +448,30 @@ void Context::checkErr(gpgme_error_t err) const
}
-/** export private key, TODO errohandling, e.g. like in seahorse (seahorse-gpg-op.c) **/
+/** export private key, TODO errohandling, e.g. like in seahorse (seahorse-gpg-op.c) **/
void Context::exportSecretKey(QString uid, QByteArray *outBuffer)
{
- QStringList arguments;
- arguments << "--armor" << "--export-secret-key" << uid;
- QByteArray *err = new QByteArray();
- executeGpgCommand(arguments, outBuffer, err);
+ QStringList arguments;
+ arguments << "--armor" << "--export-secret-key" << uid;
+ QByteArray *err = new QByteArray();
+ executeGpgCommand(arguments, outBuffer, err);
}
/** return type should be gpgme_error_t*/
void Context::executeGpgCommand(QStringList arguments, QByteArray *stdOut, QByteArray *stdErr)
{
- gpgme_engine_info_t engine = gpgme_ctx_get_engine_info(mCtx);
+ gpgme_engine_info_t engine = gpgme_ctx_get_engine_info(mCtx);
- QStringList args;
- args << "--homedir" << engine->home_dir << "--batch" << arguments;
+ QStringList args;
+ args << "--homedir" << engine->home_dir << "--batch" << arguments;
- QProcess gpg;
+ QProcess gpg;
gpg.start(engine->file_name, args);
gpg.waitForFinished();
- *stdOut = gpg.readAllStandardOutput();
- *stdErr = gpg.readAllStandardError();
+ *stdOut = gpg.readAllStandardOutput();
+ *stdErr = gpg.readAllStandardError();
}
}
diff --git a/context.h b/context.h
index 35f3aad..5acc04b 100644
--- a/context.h
+++ b/context.h
@@ -69,7 +69,7 @@ public:
bool decrypt(const QByteArray &inBuffer, QByteArray *outBuffer);
void clearCache();
void exportSecretKey(QString uid, QByteArray *outBuffer);
- gpgme_key_t getKeyDetails(QString uid);
+ gpgme_key_t getKeyDetails(QString uid);
signals:
void keyDBChanged();
@@ -90,10 +90,10 @@ private:
gpgme_error_t passphrase(const char *uid_hint,
const char *passphrase_info,
int last_was_bad, int fd);
-
- void executeGpgCommand(QStringList arguments,
- QByteArray *stdOut,
- QByteArray *stdErr);
+
+ void executeGpgCommand(QStringList arguments,
+ QByteArray *stdOut,
+ QByteArray *stdErr);
};
} // namespace GpgME
diff --git a/fileencryptiondialog.cpp b/fileencryptiondialog.cpp
index b7b009d..d1f02ef 100755
--- a/fileencryptiondialog.cpp
+++ b/fileencryptiondialog.cpp
@@ -35,7 +35,7 @@
#include "fileencryptiondialog.h"
FileEncryptionDialog::FileEncryptionDialog(GpgME::Context *ctx, QString iconPath, QWidget *parent)
- : QDialog(parent)
+ : QDialog(parent)
{
@@ -104,36 +104,36 @@ FileEncryptionDialog::FileEncryptionDialog(GpgME::Context *ctx, QString iconPath
void FileEncryptionDialog::selectInputFile()
{
- QString path="";
- if(inputFileEdit->text().size() > 0) {
- path=QFileInfo(inputFileEdit->text()).absolutePath();
+ QString path = "";
+ if (inputFileEdit->text().size() > 0) {
+ path = QFileInfo(inputFileEdit->text()).absolutePath();
}
// QString infileName = QFileDialog::getOpenFileName(this, tr("Open File"), path, tr("Files") + tr("All Files (*)"));
QString infileName = QFileDialog::getOpenFileName(this, tr("Open File"), path);
inputFileEdit->setText(infileName);
-
+
// try to find a matching output-filename, if not yet done
- if(infileName > 0 && outputFileEdit->text().size()==0) {
- if(radioEnc->isChecked()) {
- outputFileEdit->setText(infileName+".asc");
- } else {
+ if (infileName > 0 && outputFileEdit->text().size() == 0) {
+ if (radioEnc->isChecked()) {
+ outputFileEdit->setText(infileName + ".asc");
+ } else {
if (infileName.endsWith(".asc", Qt::CaseInsensitive)) {
QString ofn = infileName;
ofn.chop(4);
outputFileEdit->setText(ofn);
} else {
- outputFileEdit->setText(infileName+".out");
- }
+ outputFileEdit->setText(infileName + ".out");
+ }
}
}
}
void FileEncryptionDialog::selectOutputFile()
{
- QString path="";
- if(outputFileEdit->text().size() > 0) {
- path=QFileInfo(outputFileEdit->text()).absolutePath();
+ QString path = "";
+ if (outputFileEdit->text().size() > 0) {
+ path = QFileInfo(outputFileEdit->text()).absolutePath();
}
QString outfileName = QFileDialog::getSaveFileName(this, tr("Save File"), path);
diff --git a/gpgwin.cpp b/gpgwin.cpp
index 344cfe1..6df933f 100644
--- a/gpgwin.cpp
+++ b/gpgwin.cpp
@@ -54,15 +54,15 @@ GpgWin::GpgWin()
setCurrentFile("");
mKeyList->addMenuAction(appendSelectedKeysAct);
- restoreSettings();
-
+ restoreSettings();
+
// open filename if provided as first command line parameter
QStringList args = qApp->arguments();
- if(args.size() > 1) {
- if(!args[1].startsWith("-")) {
- if(QFile::exists(args[1]))
+ if (args.size() > 1) {
+ if (!args[1].startsWith("-")) {
+ if (QFile::exists(args[1]))
loadFile(args[1]);
- }
+ }
}
}
@@ -72,33 +72,33 @@ void GpgWin::restoreSettings()
// state sets pos & size of dock-widgets
this->restoreState(settings.value("window/windowState").toByteArray());
- // Restore window size & location
- if (settings.value("window/windowSave").toBool()) {
- QPoint pos = settings.value("window/pos", QPoint(100, 100)).toPoint();
- QSize size = settings.value("window/size", QSize(800, 450)).toSize();
- this->resize(size);
- this->move(pos);
- } else {
- this->resize(QSize(800,450));
- this->move(QPoint(100, 100));
- }
-
- // Iconsize
- QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
- this->setIconSize(iconSize);
-
- // Iconstyle
+ // Restore window size & location
+ if (settings.value("window/windowSave").toBool()) {
+ QPoint pos = settings.value("window/pos", QPoint(100, 100)).toPoint();
+ QSize size = settings.value("window/size", QSize(800, 450)).toSize();
+ this->resize(size);
+ this->move(pos);
+ } else {
+ this->resize(QSize(800, 450));
+ this->move(QPoint(100, 100));
+ }
+
+ // Iconsize
+ QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
+ this->setIconSize(iconSize);
+
+ // Iconstyle
Qt::ToolButtonStyle buttonStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt());
- this->setToolButtonStyle(buttonStyle);
-
- // Checked Keys
- if (settings.value("keys/keySave").toBool()) {
- QStringList keyIds = settings.value("keys/keyList").toStringList();
- mKeyList->setChecked(&keyIds);
- }
+ this->setToolButtonStyle(buttonStyle);
+
+ // Checked Keys
+ if (settings.value("keys/keySave").toBool()) {
+ QStringList keyIds = settings.value("keys/keyList").toStringList();
+ mKeyList->setChecked(&keyIds);
+ }
}
- void GpgWin::createActions()
+void GpgWin::createActions()
{
/** Main Menu
*/
@@ -215,7 +215,7 @@ void GpgWin::restoreSettings()
aboutAct->setIcon(QIcon(iconPath + "help.png"));
aboutAct->setToolTip(tr("Show the application's About box"));
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
-
+
/** Popup-Menu-Action for KeyList
*/
appendSelectedKeysAct = new QAction(tr("Append Selected Key(s) To Text"), this);
@@ -238,7 +238,7 @@ void GpgWin::createMenus()
editMenu->addAction(cutAct);
editMenu->addAction(pasteAct);
editMenu->addAction(selectallAct);
- editMenu->addAction(openSettingsAct);
+ editMenu->addAction(openSettingsAct);
cryptMenu = menuBar()->addMenu(tr("&Crypt"));
cryptMenu->addAction(encryptAct);
@@ -255,7 +255,7 @@ void GpgWin::createMenus()
keyMenu->addAction(openKeyManagementAct);
viewMenu = menuBar()->addMenu(tr("&View"));
-
+
helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(aboutAct);
}
@@ -287,8 +287,8 @@ void GpgWin::createStatusBar()
void GpgWin::createDockWindows()
{
- /** KeyList-Dockwindow
- */
+ /** KeyList-Dockwindow
+ */
dock = new QDockWidget(tr("Encrypt for:"), this);
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, dock);
@@ -298,7 +298,7 @@ void GpgWin::createDockWindows()
/** Attachments-Dockwindow
*/
aDock = new QDockWidget(tr("Attached files:"), this);
- aDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea );
+ aDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
addDockWidget(Qt::BottomDockWidgetArea, aDock);
aDock->setWidget(mAttachments);
// hide till attachmendt is decrypted
@@ -310,37 +310,37 @@ void GpgWin::createDockWindows()
void GpgWin::closeEvent(QCloseEvent *event)
{
- /** ask to save changes, if text modified
- */
+ /** ask to save changes, if text modified
+ */
if (maybeSave()) {
event->accept();
} else {
event->ignore();
}
-
- /** Save the settings
- */
- // window position and size
- settings.setValue("window/windowState", saveState());
- settings.setValue("window/pos", pos());
- settings.setValue("window/size", size());
-
- // keyid-list of private checked keys
- if ( settings.value("keys/keySave").toBool() ) {
- QStringList *keyIds = mKeyList->getPrivateChecked();
- if (!keyIds->isEmpty()){
- settings.setValue("keys/keyList", *keyIds);
- } else {
- settings.setValue("keys/keyList","");
- }
- } else {
- settings.remove("keys/keyList");
- }
-
- /********************
- * Quit programm
- * ******************/
- QMainWindow::closeEvent(event);
+
+ /** Save the settings
+ */
+ // window position and size
+ settings.setValue("window/windowState", saveState());
+ settings.setValue("window/pos", pos());
+ settings.setValue("window/size", size());
+
+ // keyid-list of private checked keys
+ if (settings.value("keys/keySave").toBool()) {
+ QStringList *keyIds = mKeyList->getPrivateChecked();
+ if (!keyIds->isEmpty()) {
+ settings.setValue("keys/keyList", *keyIds);
+ } else {
+ settings.setValue("keys/keyList", "");
+ }
+ } else {
+ settings.remove("keys/keyList");
+ }
+
+ /********************
+ * Quit programm
+ * ******************/
+ QMainWindow::closeEvent(event);
}
void GpgWin::open()
@@ -481,7 +481,7 @@ void GpgWin::about()
void GpgWin::encrypt()
{
QStringList *uidList = mKeyList->getChecked();
-
+
QByteArray *tmp = new QByteArray();
if (mCtx->encrypt(uidList, edit->toPlainText().toUtf8(), tmp)) {
QString *tmp2 = new QString(*tmp);
@@ -497,7 +497,7 @@ void GpgWin::decrypt()
mCtx->decrypt(text, tmp);
if (!tmp->isEmpty()) {
// is it mime?
- if(settings.value("mime/parseMime").toBool()) {
+ if (settings.value("mime/parseMime").toBool()) {
parseMime(tmp);
}
edit->setPlainText(QString::fromUtf8(*tmp));
@@ -508,11 +508,12 @@ void GpgWin::decrypt()
* if this is mime, split text and attachments...
* message contains only text afterwards
*/
-void GpgWin::parseMime(QByteArray *message) {
+void GpgWin::parseMime(QByteArray *message)
+{
- if( ! Mime::isMultipart(message) ) {
- qDebug() << "no multipart";
- return;
+ if (! Mime::isMultipart(message)) {
+ qDebug() << "no multipart";
+ return;
}
qDebug() << "multipart";
@@ -521,11 +522,11 @@ void GpgWin::parseMime(QByteArray *message) {
Mime *mime = new Mime(message);
foreach(MimePart tmp, mime->parts()) {
- if(tmp.getValue("Content-Type")=="text/plain"
- && tmp.getValue("Content-Transfer-Encoding") != "base64") {
+ if (tmp.getValue("Content-Type") == "text/plain"
+ && tmp.getValue("Content-Transfer-Encoding") != "base64") {
QByteArray body;
- if(tmp.getValue("Content-Transfer-Encoding")=="quoted-printable") {
+ if (tmp.getValue("Content-Transfer-Encoding") == "quoted-printable") {
Mime::quotedPrintableDecode(tmp.body, body);
} else {
@@ -535,13 +536,13 @@ void GpgWin::parseMime(QByteArray *message) {
pText.append(QString(body));
} else {
- (mAttachments->addMimePart(&tmp));
- showmadock=true;
- }
+ (mAttachments->addMimePart(&tmp));
+ showmadock = true;
}
+ }
*message = pText.toAscii();
- if(showmadock) aDock->show();
+ if (showmadock) aDock->show();
}
/**
@@ -573,7 +574,7 @@ void GpgWin::importKeyFromFile()
QFile file;
QByteArray inBuffer;
- QString fileName = QFileDialog::getOpenFileName(this, tr("Open Key"), "", tr("Key Files") + " (*.asc *.txt);;"+tr("All Files")+" (*)");
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Open Key"), "", tr("Key Files") + " (*.asc *.txt);;" + tr("All Files") + " (*)");
if (! fileName.isNull()) {
file.setFileName(fileName);
if (!file.open(QIODevice::ReadOnly)) {
@@ -654,13 +655,13 @@ void GpgWin::fileEncryption()
}
void GpgWin::openSettingsDialog()
{
- new SettingsDialog(this);
-// restoreSettings();
- // Iconsize
- QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
- this->setIconSize(iconSize);
-
- // Iconstyle
- Qt::ToolButtonStyle buttonStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt());
- this->setToolButtonStyle(buttonStyle);
+ new SettingsDialog(this);
+// restoreSettings();
+ // Iconsize
+ QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
+ this->setIconSize(iconSize);
+
+ // Iconstyle
+ Qt::ToolButtonStyle buttonStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt());
+ this->setToolButtonStyle(buttonStyle);
}
diff --git a/gpgwin.h b/gpgwin.h
index 60f6f13..a96b780 100644
--- a/gpgwin.h
+++ b/gpgwin.h
@@ -61,7 +61,7 @@ public:
protected:
void closeEvent(QCloseEvent *event);
-
+
public slots:
void encrypt();
void decrypt();
diff --git a/keydetailsdialog.cpp b/keydetailsdialog.cpp
index 0712143..51c472d 100644
--- a/keydetailsdialog.cpp
+++ b/keydetailsdialog.cpp
@@ -18,21 +18,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-
+
#include "keydetailsdialog.h"
//#include "QDebug"
-KeyDetailsDialog::KeyDetailsDialog(GpgME::Context* ctx, gpgme_key_t key) {
-
+KeyDetailsDialog::KeyDetailsDialog(GpgME::Context* ctx, gpgme_key_t key)
+{
+
mCtx = ctx;
keyid = new QString(key->subkeys->keyid);
-
- ownerBox = new QGroupBox(tr("Owner details"));
- keyBox = new QGroupBox(tr("Key details"));
- fingerprintBox = new QGroupBox(tr("Fingerprint"));
- buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
-
+
+ ownerBox = new QGroupBox(tr("Owner details"));
+ keyBox = new QGroupBox(tr("Key details"));
+ fingerprintBox = new QGroupBox(tr("Fingerprint"));
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
+
nameLabel = new QLabel(tr("Name:"));
emailLabel = new QLabel(tr("E-Mailaddress:"));
commentLabel = new QLabel(tr("Comment:"));
@@ -46,20 +47,20 @@ KeyDetailsDialog::KeyDetailsDialog(GpgME::Context* ctx, gpgme_key_t key) {
commentVarLabel = new QLabel(key->uids->comment);
//keySizeVarLabel = new QLabel();
QString keySizeVal, keyExpireVal, keyCreatedVal, keyAlgoVal;
-
- if ( key->subkeys->expires == 0 ) {
+
+ if (key->subkeys->expires == 0) {
keyExpireVal = tr("Never");
} else {
keyExpireVal = QDateTime::fromTime_t(key->subkeys->expires).toString("dd. MMM. yyyy");
}
-
+
keyAlgoVal = gpgme_pubkey_algo_name(key->subkeys->pubkey_algo);
keyCreatedVal = QDateTime::fromTime_t(key->subkeys->timestamp).toString("dd. MMM. yyyy");
-
+
// have el-gamal key?
- if(key->subkeys->next) {
- keySizeVal.sprintf("%d / %d", int(key->subkeys->length), int(key->subkeys->next->length) );
- if ( key->subkeys->next->expires == 0 ) {
+ if (key->subkeys->next) {
+ keySizeVal.sprintf("%d / %d", int(key->subkeys->length), int(key->subkeys->next->length));
+ if (key->subkeys->next->expires == 0) {
keyExpireVal += tr(" / Never");
} else {
keyExpireVal += " / " + QDateTime::fromTime_t(key->subkeys->next->expires).toString("dd. MMM. yyyy");
@@ -67,19 +68,19 @@ KeyDetailsDialog::KeyDetailsDialog(GpgME::Context* ctx, gpgme_key_t key) {
keyAlgoVal.append(" / ").append(gpgme_pubkey_algo_name(key->subkeys->next->pubkey_algo));
keyCreatedVal += " / " + QDateTime::fromTime_t(key->subkeys->next->timestamp).toString("dd. MMM. yyyy");
} else {
- keySizeVal.setNum( int(key->subkeys->length));
+ keySizeVal.setNum(int(key->subkeys->length));
}
-
+
keySizeVarLabel = new QLabel(keySizeVal);
expireVarLabel = new QLabel(keyExpireVal);
- createdVarLabel = new QLabel(keyCreatedVal);
+ createdVarLabel = new QLabel(keyCreatedVal);
algorithmVarLabel = new QLabel(keyAlgoVal);
-
+
mvbox = new QVBoxLayout();
vboxKD = new QGridLayout();
- vboxOD = new QGridLayout();
-
+ vboxOD = new QGridLayout();
+
vboxOD->addWidget(nameLabel, 0, 0);
vboxOD->addWidget(emailLabel, 1, 0);
vboxOD->addWidget(commentLabel, 2, 0);
@@ -96,54 +97,55 @@ KeyDetailsDialog::KeyDetailsDialog(GpgME::Context* ctx, gpgme_key_t key) {
vboxKD->addWidget(expireVarLabel, 1, 1);
vboxKD->addWidget(algorithmVarLabel, 3, 1);
vboxKD->addWidget(createdVarLabel, 4, 1);
-
- ownerBox->setLayout(vboxOD);
- mvbox->addWidget(ownerBox);
-
- keyBox->setLayout(vboxKD);
- mvbox->addWidget(keyBox);
-
- vboxFP = new QVBoxLayout();
+
+ ownerBox->setLayout(vboxOD);
+ mvbox->addWidget(ownerBox);
+
+ keyBox->setLayout(vboxKD);
+ mvbox->addWidget(keyBox);
+
+ vboxFP = new QVBoxLayout();
fingerPrintLabel = new QLabel(beautifyFingerprint(key->subkeys->fpr));
fingerPrintLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
- vboxFP->addWidget(fingerPrintLabel);
- fingerprintBox->setLayout(vboxFP);
- mvbox->addWidget(fingerprintBox);
+ vboxFP->addWidget(fingerPrintLabel);
+ fingerprintBox->setLayout(vboxFP);
+ mvbox->addWidget(fingerprintBox);
- if(key->secret) {
+ if (key->secret) {
QGroupBox *privKeyBox = new QGroupBox(tr("Private Key"));
QVBoxLayout *vboxPK = new QVBoxLayout();
-
+
QPushButton *exportButton = new QPushButton(tr("Export Private Key"));
vboxPK->addWidget(exportButton);
connect(exportButton, SIGNAL(clicked()), this, SLOT(exportPrivateKey()));
-
+
privKeyBox->setLayout(vboxPK);
mvbox->addWidget(privKeyBox);
}
- mvbox->addWidget(buttonBox);
-
- this->setLayout(mvbox);
+ mvbox->addWidget(buttonBox);
+
+ this->setLayout(mvbox);
this->setWindowTitle(tr("Keydetails"));
- this->show();
+ this->show();
- exec();
+ exec();
}
-void KeyDetailsDialog::exportPrivateKey() {
-
+void KeyDetailsDialog::exportPrivateKey()
+{
+
int ret = QMessageBox::information(this, tr("Exporting private Key"),
- tr("You are about to export your private key.\n"
- "This is NOT your public key, so don't give it away.\n"
- "Make sure you keep it save."),
- QMessageBox::Cancel | QMessageBox::Ok);
-
- if(ret==QMessageBox::Ok) {
-
+ tr("You are about to export your private key.\n"
+ "This is NOT your public key, so don't give it away.\n"
+ "Make sure you keep it save."),
+ QMessageBox::Cancel | QMessageBox::Ok);
+
+ if (ret == QMessageBox::Ok) {
+
QByteArray *keyArray = new QByteArray();
mCtx->exportSecretKey(*keyid, keyArray);
-
+
QString fileName = QFileDialog::getSaveFileName(this, tr("Export Key To File"), "", tr("Key Files ") + " (*.asc *.txt);;All Files (*)");
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
@@ -153,13 +155,14 @@ void KeyDetailsDialog::exportPrivateKey() {
file.close();
delete keyArray;
}
-
+
}
-QString KeyDetailsDialog::beautifyFingerprint(QString fingerprint) {
- uint len = fingerprint.length();
- if((len>0) && (len%4 == 0))
- for (uint n = 0; 4 * (n + 1) < len; ++n)
- fingerprint.insert(5 * n + 4, ' ');
- return fingerprint;
+QString KeyDetailsDialog::beautifyFingerprint(QString fingerprint)
+{
+ uint len = fingerprint.length();
+ if ((len > 0) && (len % 4 == 0))
+ for (uint n = 0; 4 *(n + 1) < len; ++n)
+ fingerprint.insert(5 * n + 4, ' ');
+ return fingerprint;
}
diff --git a/keydetailsdialog.h b/keydetailsdialog.h
index cb452db..f15df48 100644
--- a/keydetailsdialog.h
+++ b/keydetailsdialog.h
@@ -38,26 +38,26 @@ class QPushButton;
class KeyDetailsDialog : public QDialog
{
Q_OBJECT
-
+
public:
KeyDetailsDialog(GpgME::Context* ctx, gpgme_key_t key);
-private slots:
- void exportPrivateKey();
-
+private slots:
+ void exportPrivateKey();
+
private:
QString *keyid;
GpgME::Context *mCtx;
- QGroupBox *ownerBox;
- QGroupBox *keyBox;
- QGroupBox *fingerprintBox;
- QDialogButtonBox *buttonBox;
+ QGroupBox *ownerBox;
+ QGroupBox *keyBox;
+ QGroupBox *fingerprintBox;
+ QDialogButtonBox *buttonBox;
QVBoxLayout *mvbox;
QGridLayout *vboxKD;
QGridLayout *vboxOD;
- QVBoxLayout *vboxFP;
+ QVBoxLayout *vboxFP;
QLabel *nameLabel;
QLabel *emailLabel;
@@ -65,19 +65,19 @@ private:
QLabel *keySizeLabel;
QLabel *expireLabel;
QLabel *createdLabel;
- QLabel *algorithmLabel;
- QLabel *fingerPrintLabel;
-
+ QLabel *algorithmLabel;
+ QLabel *fingerPrintLabel;
+
QLabel *nameVarLabel;
QLabel *emailVarLabel;
QLabel *commentVarLabel;
QLabel *keySizeVarLabel;
QLabel *expireVarLabel;
QLabel *createdVarLabel;
- QLabel *algorithmVarLabel;
-
-
- QString beautifyFingerprint(QString fingerprint);
+ QLabel *algorithmVarLabel;
+
+
+ QString beautifyFingerprint(QString fingerprint);
};
#endif // __KEYDETAILSDIALOG_H__
diff --git a/keylist.cpp b/keylist.cpp
index a481076..d9976fd 100644
--- a/keylist.cpp
+++ b/keylist.cpp
@@ -113,7 +113,7 @@ QStringList *KeyList::getPrivateChecked()
{
QStringList *ret = new QStringList();
for (int i = 0; i < mKeyList->rowCount(); i++) {
- if ((mKeyList->item(i, 0)->checkState() == Qt::Checked) && (mKeyList->item(i,1))) {
+ if ((mKeyList->item(i, 0)->checkState() == Qt::Checked) && (mKeyList->item(i, 1))) {
*ret << mKeyList->item(i, 4)->text();
}
}
@@ -122,13 +122,13 @@ QStringList *KeyList::getPrivateChecked()
void KeyList::setChecked(QStringList *keyIds)
{
- if (!keyIds->isEmpty()){
- for (int i = 0; i < mKeyList->rowCount(); i++) {
- if (keyIds->contains(mKeyList->item(i, 4)->text())) {
- mKeyList->item(i, 0)->setCheckState(Qt::Checked);
- }
- }
- }
+ if (!keyIds->isEmpty()) {
+ for (int i = 0; i < mKeyList->rowCount(); i++) {
+ if (keyIds->contains(mKeyList->item(i, 4)->text())) {
+ mKeyList->item(i, 0)->setCheckState(Qt::Checked);
+ }
+ }
+ }
}
/*QStringList *KeyList::getPrivateChecked()
diff --git a/keymgmt.cpp b/keymgmt.cpp
index ed59914..2cf21c0 100755
--- a/keymgmt.cpp
+++ b/keymgmt.cpp
@@ -39,28 +39,28 @@ KeyMgmt::KeyMgmt(GpgME::Context *ctx, QString iconpath)
createActions();
createMenus();
createToolBars();
-
+
/* Restore the iconstyle */
- QSettings settings;
- settings.sync();
- QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
+ QSettings settings;
+ settings.sync();
+ QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
Qt::ToolButtonStyle buttonStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt());
this->setIconSize(iconSize);
- this->setToolButtonStyle(buttonStyle);
+ this->setToolButtonStyle(buttonStyle);
// state sets pos & size of dock-widgets
this->restoreState(settings.value("keymgmt/windowState").toByteArray());
- // Restore window size & location
- Qt::CheckState windowSave = static_cast<Qt::CheckState>(settings.value("window/windowSave", Qt::Unchecked).toUInt());
- if (windowSave == Qt::Checked) {
- QPoint pos = settings.value("keymgmt/pos", QPoint(100, 100)).toPoint();
- QSize size = settings.value("keymgmt/size", QSize(800, 450)).toSize();
- this->resize(size);
- this->move(pos);
- } else {
- this->resize(QSize(800,400));
- }
+ // Restore window size & location
+ Qt::CheckState windowSave = static_cast<Qt::CheckState>(settings.value("window/windowSave", Qt::Unchecked).toUInt());
+ if (windowSave == Qt::Checked) {
+ QPoint pos = settings.value("keymgmt/pos", QPoint(100, 100)).toPoint();
+ QSize size = settings.value("keymgmt/size", QSize(800, 450)).toSize();
+ this->resize(size);
+ this->move(pos);
+ } else {
+ this->resize(QSize(800, 400));
+ }
setWindowTitle(tr("Keymanagement"));
mKeyList->addMenuAction(deleteSelectedKeysAct);
@@ -108,7 +108,7 @@ void KeyMgmt::createActions()
generateKeyDialogAct->setToolTip(tr("Generate New Key"));
generateKeyDialogAct->setIcon(QIcon(mIconPath + "key_generate.png"));
connect(generateKeyDialogAct, SIGNAL(triggered()), this, SLOT(generateKeyDialog()));
-
+
showKeyDetailsAct = new QAction(tr("Show Keydetails"), this);
showKeyDetailsAct->setToolTip(tr("Show Details for this Key"));
connect(showKeyDetailsAct, SIGNAL(triggered()), this, SLOT(showKeyDetails()));
@@ -174,29 +174,30 @@ void KeyMgmt::deleteCheckedKeys()
deleteKeysWithWarning(mKeyList->getSelected());
}
-void KeyMgmt::deleteKeysWithWarning(QStringList *uidList) {
-
+void KeyMgmt::deleteKeysWithWarning(QStringList *uidList)
+{
+
/**
* TODO: Different Messages for private/public key, check if
* more than one selected... compare to seahorse "delete-dialog"
*/
-
+
int ret = QMessageBox::question(this, tr("Deleting Keys"),
- tr("Are you sure that you want to delete the selected keys?.\n"
- "The action can not be undone."),
- QMessageBox::No | QMessageBox::Yes);
-
- if(ret==QMessageBox::Yes) {
+ tr("Are you sure that you want to delete the selected keys?.\n"
+ "The action can not be undone."),
+ QMessageBox::No | QMessageBox::Yes);
+
+ if (ret == QMessageBox::Yes) {
mCtx->deleteKeys(uidList);
}
}
void KeyMgmt::showKeyDetails()
{
- // TODO: first...?
- gpgme_key_t key = mCtx->getKeyDetails(mKeyList->getSelected()->first());
-
- new KeyDetailsDialog(mCtx, key);
+ // TODO: first...?
+ gpgme_key_t key = mCtx->getKeyDetails(mKeyList->getSelected()->first());
+
+ new KeyDetailsDialog(mCtx, key);
}
void KeyMgmt::exportKeyToFile()
@@ -344,7 +345,7 @@ void KeyMgmt::keyGenAccept()
"Key-Type: DSA\n"
"Key-Length: 1024\n"
"Subkey-Type: ELG-E\n"
- "Subkey-Length: "
+ "Subkey-Length: "
+ keySizeSpinBox->cleanText() + "\n"
"Name-Real: " + nameEdit->text() + "\n";
if (!(commentEdit->text().isEmpty())) {
@@ -361,7 +362,7 @@ void KeyMgmt::keyGenAccept()
if (!(passwordEdit->text().isEmpty())) {
keyGenParams += "Passphrase: " + passwordEdit->text() + "\n";
}
- keyGenParams += "</GnupgKeyParms>";
+ keyGenParams += "</GnupgKeyParms>";
KeyGenThread *kg = new KeyGenThread(keyGenParams, mCtx);
kg->start();
@@ -443,11 +444,11 @@ int KeyMgmt::checkPassWordStrength()
void KeyMgmt::closeEvent(QCloseEvent *event)
{
- QSettings settings;
- //settings.setValue("geometry", saveGeometry());
- settings.setValue("keymgmt/windowState", saveState());
- settings.setValue("keymgmt/pos", pos());
- settings.setValue("keymgmt/size", size());
-
- QMainWindow::closeEvent(event);
+ QSettings settings;
+ //settings.setValue("geometry", saveGeometry());
+ settings.setValue("keymgmt/windowState", saveState());
+ settings.setValue("keymgmt/pos", pos());
+ settings.setValue("keymgmt/size", size());
+
+ QMainWindow::closeEvent(event);
}
diff --git a/keymgmt.h b/keymgmt.h
index a12b5b5..cc5f72f 100755
--- a/keymgmt.h
+++ b/keymgmt.h
@@ -86,7 +86,7 @@ private:
QAction *deleteSelectedKeysAct;
QAction *generateKeyDialogAct;
QAction *closeAct;
- QAction *showKeyDetailsAct;
+ QAction *showKeyDetailsAct;
KeyGenThread *keyGenThread;
QMessageBox msgbox;
/**
diff --git a/main.cpp b/main.cpp
index 0e08786..2bd8a6c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -35,8 +35,8 @@ int main(int argc, char *argv[])
app.setApplicationVersion("0.2.3");
app.setApplicationName("gpg4usb");
-
- // QSettings uses org-name for automatically setting path...
+
+ // QSettings uses org-name for automatically setting path...
app.setOrganizationName("conf");
// specify default path & format for QSettings
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, qApp->applicationDirPath());
@@ -44,8 +44,8 @@ int main(int argc, char *argv[])
QSettings settings;
QString lang = settings.value("int/lang", QLocale::system().name()).toString();
- if(lang.isEmpty()) lang = QLocale::system().name();
-
+ if (lang.isEmpty()) lang = QLocale::system().name();
+
//internationalize
QTranslator translator;
translator.load("ts/gpg4usb_" + lang,
diff --git a/mime.cpp b/mime.cpp
index d68b9b5..f2afd65 100644
--- a/mime.cpp
+++ b/mime.cpp
@@ -38,46 +38,46 @@
Mime::Mime(QByteArray *message)
{
- splitParts(message);
+ splitParts(message);
/*
- mMessage = message;
- int bStart = mMessage->indexOf("boundary=\"") + 10 ;
- int bEnd = mMessage->indexOf("\"\n", bStart );
+ mMessage = message;
+ int bStart = mMessage->indexOf("boundary=\"") + 10 ;
+ int bEnd = mMessage->indexOf("\"\n", bStart );
- qDebug() << "bStart: " << bStart << " bEnd: " << bEnd;
- mBoundary = new QByteArray(mMessage->mid(bStart, bEnd - bStart));
- qDebug() << "boundary: " << *mBoundary;
+ qDebug() << "bStart: " << bStart << " bEnd: " << bEnd;
+ mBoundary = new QByteArray(mMessage->mid(bStart, bEnd - bStart));
+ qDebug() << "boundary: " << *mBoundary;
- Part *p1 = new Part();
+ Part *p1 = new Part();
- int nb = mMessage->indexOf(*mBoundary, bEnd) + mBoundary->length() +1 ;
- qDebug() << "nb: " << nb;
- int eh = mMessage->indexOf("\n\n", nb);
- qDebug() << "eh: " << eh;
- QByteArray *header = new QByteArray(mMessage->mid(nb , eh - nb));
- qDebug() << "header:" << header;
+ int nb = mMessage->indexOf(*mBoundary, bEnd) + mBoundary->length() +1 ;
+ qDebug() << "nb: " << nb;
+ int eh = mMessage->indexOf("\n\n", nb);
+ qDebug() << "eh: " << eh;
+ QByteArray *header = new QByteArray(mMessage->mid(nb , eh - nb));
+ qDebug() << "header:" << header;
- // split header at newlines
- foreach(QByteArray tmp , header->split(* "\n")) {
+ // split header at newlines
+ foreach(QByteArray tmp , header->split(* "\n")) {
// split lines at :
QList<QByteArray> tmp2 = tmp.split(* ":");
p1->header.insert(QString(tmp2[0].trimmed()), QString(tmp2[1].trimmed()));
- }
+ }
- QHashIterator<QString, QString> i(p1->header);
- while (i.hasNext()) {
+ QHashIterator<QString, QString> i(p1->header);
+ while (i.hasNext()) {
i.next();
qDebug() << "found: " << i.key() << ":" << i.value() << endl;
- }
+ }
- int nb2 = mMessage->indexOf(*mBoundary, eh);
+ int nb2 = mMessage->indexOf(*mBoundary, eh);
- p1->body = mMessage->mid(eh , nb2 - eh);
+ p1->body = mMessage->mid(eh , nb2 - eh);
- QTextCodec *codec = QTextCodec::codecForName("ISO-8859-15");
- QString qs = codec->toUnicode(p1->body);
- qDebug() << "body: " << qs;
-*/
+ QTextCodec *codec = QTextCodec::codecForName("ISO-8859-15");
+ QString qs = codec->toUnicode(p1->body);
+ qDebug() << "body: " << qs;
+ */
}
Mime::~Mime()
@@ -85,21 +85,22 @@ Mime::~Mime()
}
-void Mime::splitParts(QByteArray *message) {
+void Mime::splitParts(QByteArray *message)
+{
int pos1, pos2, headEnd;
MimePart p_tmp;
// find the boundary
pos1 = message->indexOf("boundary=\"") + 10 ;
- pos2 = message->indexOf("\"\n", pos1 );
+ pos2 = message->indexOf("\"\n", pos1);
QByteArray boundary = message->mid(pos1, pos2 - pos1);
//qDebug() << "boundary: " << boundary;
- while ( pos2 > pos1 ) {
+ while (pos2 > pos1) {
- pos1 = message->indexOf(boundary, pos2) + boundary.length() +1 ;
+ pos1 = message->indexOf(boundary, pos2) + boundary.length() + 1 ;
headEnd = message->indexOf("\n\n", pos1);
- if(headEnd < 0)
+ if (headEnd < 0)
break;
QByteArray header = message->mid(pos1 , headEnd - pos1);
@@ -112,7 +113,8 @@ void Mime::splitParts(QByteArray *message) {
}
}
-QList<HeadElem> Mime::parseHeader(QByteArray *header){
+QList<HeadElem> Mime::parseHeader(QByteArray *header)
+{
QList<HeadElem> ret;
@@ -127,21 +129,21 @@ QList<HeadElem> Mime::parseHeader(QByteArray *header){
HeadElem elem;
//split lines at :
QList<QByteArray> tmp2 = line.split(* ":");
- elem.name = tmp2[0].trimmed();
- if(tmp2[1].contains(';')) {
- // split lines at ;
- // TODO: what if ; is inside ""
- QList<QByteArray> tmp3 = tmp2[1].split(* ";");
- elem.value = QString(tmp3.takeFirst().trimmed());
- foreach(QByteArray tmp4, tmp3) {
- QList<QByteArray> tmp5 = tmp4.split(* "=");
- elem.params.insert(QString( tmp5[0].trimmed() ), QString(tmp5[1].trimmed()));
- }
- } else {
- elem.value = tmp2[1].trimmed();
+ elem.name = tmp2[0].trimmed();
+ if (tmp2[1].contains(';')) {
+ // split lines at ;
+ // TODO: what if ; is inside ""
+ QList<QByteArray> tmp3 = tmp2[1].split(* ";");
+ elem.value = QString(tmp3.takeFirst().trimmed());
+ foreach(QByteArray tmp4, tmp3) {
+ QList<QByteArray> tmp5 = tmp4.split(* "=");
+ elem.params.insert(QString(tmp5[0].trimmed()), QString(tmp5[1].trimmed()));
}
- ret.append(elem);
+ } else {
+ elem.value = tmp2[1].trimmed();
}
+ ret.append(elem);
+ }
return ret;
}
@@ -158,83 +160,72 @@ bool Mime::isMultipart(QByteArray *message)
*/
-static const char hexChars[16] =
-{
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+static const char hexChars[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
/******************************** KCodecs ********************************/
// strchr(3) for broken systems.
static int rikFindChar(register const char * _s, const char c)
{
- register const char * s = _s;
+ register const char * s = _s;
- while (true)
- {
- if ((0 == *s) || (c == *s)) break; ++s;
- if ((0 == *s) || (c == *s)) break; ++s;
- if ((0 == *s) || (c == *s)) break; ++s;
- if ((0 == *s) || (c == *s)) break; ++s;
- }
+ while (true) {
+ if ((0 == *s) || (c == *s)) break; ++s;
+ if ((0 == *s) || (c == *s)) break; ++s;
+ if ((0 == *s) || (c == *s)) break; ++s;
+ if ((0 == *s) || (c == *s)) break; ++s;
+ }
- return s - _s;
+ return s - _s;
}
void Mime::quotedPrintableDecode(const QByteArray& in, QByteArray& out)
{
- // clear out the output buffer
- out.resize (0);
- if (in.isEmpty())
- return;
-
- char *cursor;
- const char *data;
- const unsigned int length = in.size();
-
- data = in.data();
- out.resize (length);
- cursor = out.data();
-
- for (unsigned int i = 0; i < length; i++)
- {
- char c(in[i]);
-
- if ('=' == c)
- {
- if (i < length - 2)
- {
- char c1 = in[i + 1];
- char c2 = in[i + 2];
-
- if (('\n' == c1) || ('\r' == c1 && '\n' == c2))
- {
- // Soft line break. No output.
- if ('\r' == c1)
- i += 2; // CRLF line breaks
- else
- i += 1;
- }
- else
- {
- // =XX encoded byte.
-
- int hexChar0 = rikFindChar(hexChars, c1);
- int hexChar1 = rikFindChar(hexChars, c2);
-
- if (hexChar0 < 16 && hexChar1 < 16)
- {
- *cursor++ = char((hexChar0 * 16) | hexChar1);
- i += 2;
- }
+ // clear out the output buffer
+ out.resize(0);
+ if (in.isEmpty())
+ return;
+
+ char *cursor;
+ const char *data;
+ const unsigned int length = in.size();
+
+ data = in.data();
+ out.resize(length);
+ cursor = out.data();
+
+ for (unsigned int i = 0; i < length; i++) {
+ char c(in[i]);
+
+ if ('=' == c) {
+ if (i < length - 2) {
+ char c1 = in[i + 1];
+ char c2 = in[i + 2];
+
+ if (('\n' == c1) || ('\r' == c1 && '\n' == c2)) {
+ // Soft line break. No output.
+ if ('\r' == c1)
+ i += 2; // CRLF line breaks
+ else
+ i += 1;
+ } else {
+ // =XX encoded byte.
+
+ int hexChar0 = rikFindChar(hexChars, c1);
+ int hexChar1 = rikFindChar(hexChars, c2);
+
+ if (hexChar0 < 16 && hexChar1 < 16) {
+ *cursor++ = char((hexChar0 * 16) | hexChar1);
+ i += 2;
+ }
+ }
+ }
+ } else {
+ *cursor++ = c;
}
- }
- }
- else
- {
- *cursor++ = c;
}
- }
- out.truncate(cursor - out.data());
+ out.truncate(cursor - out.data());
}
diff --git a/mime.h b/mime.h
index 8eeadb8..7ce4162 100644
--- a/mime.h
+++ b/mime.h
@@ -27,59 +27,61 @@
#include <QDebug>
-class HeadElem {
+class HeadElem
+{
public:
QString name;
QString value;
QHash<QString, QString> params;
-/* QDataStream & operator<<(QDataStream& Stream, const HeadElem& H)
- {
- return Stream << H.name << " : " << H.value;
- }*/
+ /* QDataStream & operator<<(QDataStream& Stream, const HeadElem& H)
+ {
+ return Stream << H.name << " : " << H.value;
+ }*/
};
-class MimePart {
+class MimePart
+{
public:
QList<HeadElem> header;
QByteArray body;
- QString getValue(QString key){
+ QString getValue(QString key) {
foreach(HeadElem tmp, header) {
//qDebug() << "gv: " << tmp.name << ":" << tmp.value;
- if(tmp.name == key)
+ if (tmp.name == key)
return tmp.value;
}
return "";
}
- QHash<QString, QString> getParams(QString key){
+ QHash<QString, QString> getParams(QString key) {
foreach(HeadElem tmp, header) {
//qDebug() << "gv: " << tmp.name << ":" << tmp.value;
- if(tmp.name == key)
+ if (tmp.name == key)
//return tmp.value;
return tmp.params;
}
return *(new QHash<QString, QString>());
}
- QString getParam(QString key, QString pKey){
+ QString getParam(QString key, QString pKey) {
foreach(HeadElem tmp, header) {
//qDebug() << "gv: " << tmp.name << ":" << tmp.value;
- if(tmp.name == key)
+ if (tmp.name == key)
return tmp.params.value(pKey);
}
return "";
}
-/* QDataStream & operator<<(QDataStream& Stream, const Part& P)
- {
- foreach(HeadElem tmp, header) {
- Stream << tmp << "\n";
- }
- return Stream;
- }*/
+ /* QDataStream & operator<<(QDataStream& Stream, const Part& P)
+ {
+ foreach(HeadElem tmp, header) {
+ Stream << tmp << "\n";
+ }
+ return Stream;
+ }*/
};
class Mime
@@ -89,8 +91,9 @@ public:
Mime(QByteArray *message); // Constructor
~Mime(); // Destructor
static bool isMultipart(QByteArray *message);
- QList<MimePart> parts()
- { return mPartList; }
+ QList<MimePart> parts() {
+ return mPartList;
+ }
void splitParts(QByteArray *message);
QList<HeadElem> parseHeader(QByteArray *header);
static void quotedPrintableDecode(const QByteArray& in, QByteArray& out);
diff --git a/settingsdialog.cpp b/settingsdialog.cpp
index 8a35dbf..1b64acd 100755
--- a/settingsdialog.cpp
+++ b/settingsdialog.cpp
@@ -36,82 +36,82 @@ class QButtonGroup;
class QGroupBox;
SettingsDialog::SettingsDialog(QWidget *parent)
- : QDialog(parent)
+ : QDialog(parent)
{
setWindowTitle(tr("Settings"));
resize(500, 200);
setModal(true);
-
- /*****************************************
- * Icon-Size-Box
- *****************************************/
+
+ /*****************************************
+ * Icon-Size-Box
+ *****************************************/
iconSizeBox = new QGroupBox(tr("Iconsize"));
- iconSizeGroup = new QButtonGroup();
- iconSizeSmall = new QRadioButton(tr("small"));
- iconSizeMedium =new QRadioButton(tr("medium"));
- iconSizeLarge = new QRadioButton(tr("large"));
+ iconSizeGroup = new QButtonGroup();
+ iconSizeSmall = new QRadioButton(tr("small"));
+ iconSizeMedium = new QRadioButton(tr("medium"));
+ iconSizeLarge = new QRadioButton(tr("large"));
- iconSizeGroup->addButton(iconSizeSmall,1);
- iconSizeGroup->addButton(iconSizeMedium,2);
- iconSizeGroup->addButton(iconSizeLarge,3);
+ iconSizeGroup->addButton(iconSizeSmall, 1);
+ iconSizeGroup->addButton(iconSizeMedium, 2);
+ iconSizeGroup->addButton(iconSizeLarge, 3);
- iconSizeBoxLayout = new QHBoxLayout();
- iconSizeBoxLayout->addWidget(iconSizeSmall);
- iconSizeBoxLayout->addWidget(iconSizeMedium);
- iconSizeBoxLayout->addWidget(iconSizeLarge);
+ iconSizeBoxLayout = new QHBoxLayout();
+ iconSizeBoxLayout->addWidget(iconSizeSmall);
+ iconSizeBoxLayout->addWidget(iconSizeMedium);
+ iconSizeBoxLayout->addWidget(iconSizeLarge);
- iconSizeBox->setLayout(iconSizeBoxLayout);
+ iconSizeBox->setLayout(iconSizeBoxLayout);
- /*****************************************
- * Icon-Style-Box
- *****************************************/
+ /*****************************************
+ * Icon-Style-Box
+ *****************************************/
iconStyleBox = new QGroupBox(tr("Iconstyle"));
- iconStyleGroup = new QButtonGroup();
- iconTextButton = new QRadioButton(tr("just text"));
- iconIconsButton =new QRadioButton(tr("just icons"));
- iconAllButton = new QRadioButton(tr("text and icons"));
-
- iconStyleGroup->addButton(iconTextButton,1);
- iconStyleGroup->addButton(iconIconsButton,2);
- iconStyleGroup->addButton(iconAllButton,3);
-
- iconStyleBoxLayout = new QHBoxLayout();
- iconStyleBoxLayout->addWidget(iconTextButton);
- iconStyleBoxLayout->addWidget(iconIconsButton);
- iconStyleBoxLayout->addWidget(iconAllButton);
-
- iconStyleBox->setLayout(iconStyleBoxLayout);
-
- /*****************************************
- * Window-Size-Box
- *****************************************/
- windowSizeBox = new QGroupBox(tr("Windowstate"));
- windowSizeBoxLayout = new QHBoxLayout();
- windowSizeCheckBox =new QCheckBox(tr("Save window size and position on exit."),this);
- windowSizeBoxLayout->addWidget(windowSizeCheckBox);
- windowSizeBox->setLayout(windowSizeBoxLayout);
-
- /*****************************************
- * Save-Checked-Keys-Box
- *****************************************/
- saveCheckedKeysBox = new QGroupBox(tr("Save Checked Keys"));
- saveCheckedKeysBoxLayout = new QHBoxLayout();
- saveCheckedKeysCheckBox =new QCheckBox(tr("Save checked private keys on exit and restore them on next start."),this);
- saveCheckedKeysBoxLayout->addWidget(saveCheckedKeysCheckBox);
- saveCheckedKeysBox->setLayout(saveCheckedKeysBoxLayout);
+ iconStyleGroup = new QButtonGroup();
+ iconTextButton = new QRadioButton(tr("just text"));
+ iconIconsButton = new QRadioButton(tr("just icons"));
+ iconAllButton = new QRadioButton(tr("text and icons"));
+
+ iconStyleGroup->addButton(iconTextButton, 1);
+ iconStyleGroup->addButton(iconIconsButton, 2);
+ iconStyleGroup->addButton(iconAllButton, 3);
+
+ iconStyleBoxLayout = new QHBoxLayout();
+ iconStyleBoxLayout->addWidget(iconTextButton);
+ iconStyleBoxLayout->addWidget(iconIconsButton);
+ iconStyleBoxLayout->addWidget(iconAllButton);
+
+ iconStyleBox->setLayout(iconStyleBoxLayout);
/*****************************************
- * Language Select Box
- *****************************************/
+ * Window-Size-Box
+ *****************************************/
+ windowSizeBox = new QGroupBox(tr("Windowstate"));
+ windowSizeBoxLayout = new QHBoxLayout();
+ windowSizeCheckBox = new QCheckBox(tr("Save window size and position on exit."), this);
+ windowSizeBoxLayout->addWidget(windowSizeCheckBox);
+ windowSizeBox->setLayout(windowSizeBoxLayout);
+
+ /*****************************************
+ * Save-Checked-Keys-Box
+ *****************************************/
+ saveCheckedKeysBox = new QGroupBox(tr("Save Checked Keys"));
+ saveCheckedKeysBoxLayout = new QHBoxLayout();
+ saveCheckedKeysCheckBox = new QCheckBox(tr("Save checked private keys on exit and restore them on next start."), this);
+ saveCheckedKeysBoxLayout->addWidget(saveCheckedKeysCheckBox);
+ saveCheckedKeysBox->setLayout(saveCheckedKeysBoxLayout);
+
+ /*****************************************
+ * Language Select Box
+ *****************************************/
QGroupBox *langBox = new QGroupBox(tr("Language"));
QVBoxLayout *vbox2 = new QVBoxLayout();
langSelectBox = new QComboBox;
lang = listLanguages();
-
+
foreach(QString l , lang) {
langSelectBox->addItem(l);
}
-
+
vbox2->addWidget(langSelectBox);
QLabel *langNote = new QLabel(tr("Language change is applied after restarting program."));
vbox2->addWidget(langNote);
@@ -123,20 +123,20 @@ SettingsDialog::SettingsDialog(QWidget *parent)
mimeParseBox = new QGroupBox(tr("MIME-parsing (Experimental)"));
mimeParseBoxLayout = new QHBoxLayout();
- mimeParseCheckBox =new QCheckBox(tr("Try to split attachments from PGP-MIME ecrypted messages."),this);
+ mimeParseCheckBox = new QCheckBox(tr("Try to split attachments from PGP-MIME ecrypted messages."), this);
mimeParseBoxLayout->addWidget(mimeParseCheckBox);
mimeParseBox->setLayout(mimeParseBoxLayout);
- /*****************************************
- * Button-Box
- *****************************************/
+ /*****************************************
+ * Button-Box
+ *****************************************/
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(applySettings()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
- /*****************************************
- * Main V-Box
- *****************************************/
+ /*****************************************
+ * Main V-Box
+ *****************************************/
vbox = new QVBoxLayout();
vbox->addWidget(iconSizeBox);
vbox->addWidget(iconStyleBox);
@@ -152,48 +152,48 @@ SettingsDialog::SettingsDialog(QWidget *parent)
}
/**********************************
- * Read the settings from config
+ * Read the settings from config
* and set the buttons and checkboxes
* appropriately
**********************************/
void SettingsDialog::setSettings()
{
- QSettings settings;
-
- //Iconsize
- QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
- switch (iconSize.height()){
- case 12: iconSizeSmall->setChecked(true);
- break;
+ QSettings settings;
+
+ //Iconsize
+ QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
+ switch (iconSize.height()) {
+ case 12: iconSizeSmall->setChecked(true);
+ break;
case 24:iconSizeMedium->setChecked(true);
- break;
+ break;
case 32:iconSizeLarge->setChecked(true);
- break;
- }
-
- // Iconstyle
- Qt::ToolButtonStyle iconStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt());
- switch (iconStyle){
- case Qt::ToolButtonTextOnly: iconTextButton->setChecked(true);
- break;
+ break;
+ }
+
+ // Iconstyle
+ Qt::ToolButtonStyle iconStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt());
+ switch (iconStyle) {
+ case Qt::ToolButtonTextOnly: iconTextButton->setChecked(true);
+ break;
case Qt::ToolButtonIconOnly:iconIconsButton->setChecked(true);
- break;
+ break;
case Qt::ToolButtonTextUnderIcon:iconAllButton->setChecked(true);
- break;
- default:
- break;
- }
-
- // Window Save and Position
- if(settings.value("window/windowSave").toBool()) windowSizeCheckBox->setCheckState(Qt::Checked);
+ break;
+ default:
+ break;
+ }
+
+ // Window Save and Position
+ if (settings.value("window/windowSave").toBool()) windowSizeCheckBox->setCheckState(Qt::Checked);
- // Keysaving
- if(settings.value("keys/keySave").toBool()) saveCheckedKeysCheckBox->setCheckState(Qt::Checked);
+ // Keysaving
+ if (settings.value("keys/keySave").toBool()) saveCheckedKeysCheckBox->setCheckState(Qt::Checked);
- // MIME-Parsing
- if(settings.value("mime/parsemime").toBool()) mimeParseCheckBox->setCheckState(Qt::Checked);
+ // MIME-Parsing
+ if (settings.value("mime/parsemime").toBool()) mimeParseCheckBox->setCheckState(Qt::Checked);
- //Language setting
+ //Language setting
QString langKey = settings.value("int/lang").toString();
QString langValue = lang.value(langKey);
langSelectBox->setCurrentIndex(langSelectBox->findText(langValue));
@@ -205,54 +205,54 @@ void SettingsDialog::setSettings()
*************************************/
void SettingsDialog::applySettings()
{
- QSettings settings;
- //settings.setValue("geometry", saveGeometry());
+ QSettings settings;
+ //settings.setValue("geometry", saveGeometry());
- switch (iconSizeGroup->checkedId()){
- case 1: settings.setValue("toolbar/iconsize", QSize(12, 12));
- break;
+ switch (iconSizeGroup->checkedId()) {
+ case 1: settings.setValue("toolbar/iconsize", QSize(12, 12));
+ break;
case 2:settings.setValue("toolbar/iconsize", QSize(24, 24));
- break;
+ break;
case 3:settings.setValue("toolbar/iconsize", QSize(32, 32));
- break;
- }
+ break;
+ }
- switch (iconStyleGroup->checkedId()){
- case 1: settings.setValue("toolbar/iconstyle", Qt::ToolButtonTextOnly);
- break;
+ switch (iconStyleGroup->checkedId()) {
+ case 1: settings.setValue("toolbar/iconstyle", Qt::ToolButtonTextOnly);
+ break;
case 2:settings.setValue("toolbar/iconstyle", Qt::ToolButtonIconOnly);
- break;
+ break;
case 3:settings.setValue("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon);
- break;
- }
+ break;
+ }
- settings.setValue("window/windowSave", windowSizeCheckBox->isChecked());
- settings.setValue("keys/keySave", saveCheckedKeysCheckBox->isChecked());
+ settings.setValue("window/windowSave", windowSizeCheckBox->isChecked());
+ settings.setValue("keys/keySave", saveCheckedKeysCheckBox->isChecked());
- settings.setValue("mime/parsemime" , mimeParseCheckBox->isChecked());
+ settings.setValue("mime/parsemime" , mimeParseCheckBox->isChecked());
settings.setValue("int/lang", lang.key(langSelectBox->currentText()));
- accept();
+ accept();
}
// http://www.informit.com/articles/article.aspx?p=1405555&seqNum=3
-QHash<QString, QString> SettingsDialog::listLanguages()
+QHash<QString, QString> SettingsDialog::listLanguages()
{
QHash<QString, QString> languages;
-
+
languages.insert("", tr("System Default"));
-
+
QString appPath = qApp->applicationDirPath();
QDir qmDir = QDir(appPath + "/ts/");
QStringList fileNames =
- qmDir.entryList(QStringList("gpg4usb_*.qm"));
+ qmDir.entryList(QStringList("gpg4usb_*.qm"));
for (int i = 0; i < fileNames.size(); ++i) {
QString locale = fileNames[i];
locale.remove(0, locale.indexOf('_') + 1);
locale.chop(3);
-
+
QTranslator translator;
translator.load(fileNames[i], qmDir.absolutePath());
QString language = translator.translate("SettingsDialog",
diff --git a/settingsdialog.h b/settingsdialog.h
index b01bc9b..f0833ee 100755
--- a/settingsdialog.h
+++ b/settingsdialog.h
@@ -42,36 +42,36 @@ public:
SettingsDialog(QWidget *parent = 0);
private:
- QGroupBox *iconSizeBox;
- QGroupBox *iconStyleBox;
- QGroupBox *windowSizeBox;
- QGroupBox *saveCheckedKeysBox;
- QGroupBox *mimeParseBox;
- QDialogButtonBox *buttonBox;
-
- QButtonGroup *iconSizeGroup;
- QButtonGroup *iconStyleGroup;
-
- QRadioButton *iconSizeSmall;
- QRadioButton *iconSizeMedium;
- QRadioButton *iconSizeLarge;
- QRadioButton *iconTextButton;
- QRadioButton *iconIconsButton;
- QRadioButton *iconAllButton;
- QCheckBox *windowSizeCheckBox;
- QCheckBox *saveCheckedKeysCheckBox;
- QCheckBox *mimeParseCheckBox;
+ QGroupBox *iconSizeBox;
+ QGroupBox *iconStyleBox;
+ QGroupBox *windowSizeBox;
+ QGroupBox *saveCheckedKeysBox;
+ QGroupBox *mimeParseBox;
+ QDialogButtonBox *buttonBox;
+
+ QButtonGroup *iconSizeGroup;
+ QButtonGroup *iconStyleGroup;
+
+ QRadioButton *iconSizeSmall;
+ QRadioButton *iconSizeMedium;
+ QRadioButton *iconSizeLarge;
+ QRadioButton *iconTextButton;
+ QRadioButton *iconIconsButton;
+ QRadioButton *iconAllButton;
+ QCheckBox *windowSizeCheckBox;
+ QCheckBox *saveCheckedKeysCheckBox;
+ QCheckBox *mimeParseCheckBox;
QComboBox *langSelectBox;
QHash<QString, QString> lang;
-
- QHBoxLayout *iconSizeBoxLayout;
- QHBoxLayout *iconStyleBoxLayout;
- QHBoxLayout *windowSizeBoxLayout;
- QHBoxLayout *saveCheckedKeysBoxLayout;
- QHBoxLayout *mimeParseBoxLayout;
- QVBoxLayout *vbox;
- void setSettings();
-
+
+ QHBoxLayout *iconSizeBoxLayout;
+ QHBoxLayout *iconStyleBoxLayout;
+ QHBoxLayout *windowSizeBoxLayout;
+ QHBoxLayout *saveCheckedKeysBoxLayout;
+ QHBoxLayout *mimeParseBoxLayout;
+ QVBoxLayout *vbox;
+ void setSettings();
+
private slots:
void applySettings();
diff --git a/winbuild/include/gpg-error.h b/winbuild/include/gpg-error.h
index c52bd07..81cc8b7 100644
--- a/winbuild/include/gpg-error.h
+++ b/winbuild/include/gpg-error.h
@@ -4,24 +4,24 @@
Copyright (C) 2003, 2004 g10 Code GmbH
This file is part of libgpg-error.
-
+
libgpg-error is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
libgpg-error is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with libgpg-error; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef GPG_ERROR_H
-#define GPG_ERROR_H 1
+#define GPG_ERROR_H 1
#include <stddef.h>
@@ -32,7 +32,7 @@
#else
#ifndef GPG_ERR_INLINE
#define GPG_ERR_INLINE
-#endif
+#endif
#endif
@@ -67,12 +67,11 @@ extern "C" {
Where as the Poo out of a welle small
Taketh his firste springing and his sours.
- --Chaucer. */
+ --Chaucer. */
/* Only use free slots, never change or reorder the existing
entries. */
-typedef enum
- {
+typedef enum {
GPG_ERR_SOURCE_UNKNOWN = 0,
GPG_ERR_SOURCE_GCRYPT = 1,
GPG_ERR_SOURCE_GPG = 2,
@@ -95,15 +94,14 @@ typedef enum
/* This is one more than the largest allowed entry. */
GPG_ERR_SOURCE_DIM = 256
- } gpg_err_source_t;
+} gpg_err_source_t;
/* The error code type gpg_err_code_t. */
/* Only use free slots, never change or reorder the existing
entries. */
-typedef enum
- {
+typedef enum {
GPG_ERR_NO_ERROR = 0,
GPG_ERR_GENERAL = 1,
GPG_ERR_UNKNOWN_PACKET = 2,
@@ -340,7 +338,7 @@ typedef enum
GPG_ERR_EOF = 16383,
/* The following error codes are used to map system errors. */
-#define GPG_ERR_SYSTEM_ERROR (1 << 15)
+#define GPG_ERR_SYSTEM_ERROR (1 << 15)
GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
@@ -485,7 +483,7 @@ typedef enum
/* This is one more than the largest allowed entry. */
GPG_ERR_CODE_DIM = 65536
- } gpg_err_code_t;
+} gpg_err_code_t;
/* The error value type gpg_error_t. */
@@ -498,24 +496,24 @@ typedef unsigned int gpg_error_t;
/* We use the lowest 16 bits of gpg_error_t for error codes. The 16th
bit indicates system errors. */
-#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1)
+#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1)
/* Bits 17 to 24 are reserved. */
/* We use the upper 8 bits of gpg_error_t for error sources. */
-#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1)
-#define GPG_ERR_SOURCE_SHIFT 24
+#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1)
+#define GPG_ERR_SOURCE_SHIFT 24
/* GCC feature test. */
#undef _GPG_ERR_HAVE_CONSTRUCTOR
#if __GNUC__
#define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
- + __GNUC_MINOR__ * 100 \
- + __GNUC_PATCHLEVEL__)
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
#if _GPG_ERR_GCC_VERSION > 30100
-#define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__))
+#define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__))
#define _GPG_ERR_HAVE_CONSTRUCTOR
#endif
#endif
@@ -528,13 +526,13 @@ typedef unsigned int gpg_error_t;
/* Initialization function. */
/* Initialize the library. This function should be run early. */
-gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
+gpg_error_t gpg_err_init(void) _GPG_ERR_CONSTRUCTOR;
/* If this is defined, the library is already initialized by the
constructor and does not need to be initialized explicitely. */
#undef GPG_ERR_INITIALIZED
#ifdef _GPG_ERR_HAVE_CONSTRUCTOR
-#define GPG_ERR_INITIALIZED 1
+#define GPG_ERR_INITIALIZED 1
#endif
@@ -543,41 +541,41 @@ gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
/* Construct an error value from an error code and source. Within a
subsystem, use gpg_error. */
static GPG_ERR_INLINE gpg_error_t
-gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
+gpg_err_make(gpg_err_source_t source, gpg_err_code_t code)
{
- return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
- : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
- | (code & GPG_ERR_CODE_MASK));
+ return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
+ : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
+ | (code & GPG_ERR_CODE_MASK));
}
/* The user should define GPG_ERR_SOURCE_DEFAULT before including this
file to specify a default source for gpg_error. */
#ifndef GPG_ERR_SOURCE_DEFAULT
-#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN
+#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN
#endif
static GPG_ERR_INLINE gpg_error_t
-gpg_error (gpg_err_code_t code)
+gpg_error(gpg_err_code_t code)
{
- return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
+ return gpg_err_make(GPG_ERR_SOURCE_DEFAULT, code);
}
/* Retrieve the error code from an error value. */
static GPG_ERR_INLINE gpg_err_code_t
-gpg_err_code (gpg_error_t err)
+gpg_err_code(gpg_error_t err)
{
- return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
+ return (gpg_err_code_t)(err & GPG_ERR_CODE_MASK);
}
/* Retrieve the error source from an error value. */
static GPG_ERR_INLINE gpg_err_source_t
-gpg_err_source (gpg_error_t err)
+gpg_err_source(gpg_error_t err)
{
- return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
- & GPG_ERR_SOURCE_MASK);
+ return (gpg_err_source_t)((err >> GPG_ERR_SOURCE_SHIFT)
+ & GPG_ERR_SOURCE_MASK);
}
@@ -585,7 +583,7 @@ gpg_err_source (gpg_error_t err)
/* Return a pointer to a string containing a description of the error
code in the error value ERR. This function is not thread-safe. */
-const char *gpg_strerror (gpg_error_t err);
+const char *gpg_strerror(gpg_error_t err);
/* Return the error string for ERR in the user-supplied buffer BUF of
size BUFLEN. This function is, in contrast to gpg_strerror,
@@ -594,11 +592,11 @@ const char *gpg_strerror (gpg_error_t err);
contains the string describing the error. If the buffer was not
large enough, ERANGE is returned and BUF contains as much of the
beginning of the error string as fits into the buffer. */
-int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
+int gpg_strerror_r(gpg_error_t err, char *buf, size_t buflen);
/* Return a pointer to a string containing a description of the error
source in the error value ERR. */
-const char *gpg_strsource (gpg_error_t err);
+const char *gpg_strsource(gpg_error_t err);
/* Mapping of system errors (errno). */
@@ -606,18 +604,18 @@ const char *gpg_strsource (gpg_error_t err);
/* Retrieve the error code for the system error ERR. This returns
GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
this). */
-gpg_err_code_t gpg_err_code_from_errno (int err);
+gpg_err_code_t gpg_err_code_from_errno(int err);
/* Retrieve the system error for the error code CODE. This returns 0
if CODE is not a system error code. */
-int gpg_err_code_to_errno (gpg_err_code_t code);
+int gpg_err_code_to_errno(gpg_err_code_t code);
/* Retrieve the error code directly from the ERRNO variable. This
returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
(report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
-gpg_err_code_t gpg_err_code_from_syserror (void);
+gpg_err_code_t gpg_err_code_from_syserror(void);
@@ -625,22 +623,22 @@ gpg_err_code_t gpg_err_code_from_syserror (void);
/* Self-documenting convenience functions. */
static GPG_ERR_INLINE gpg_error_t
-gpg_err_make_from_errno (gpg_err_source_t source, int err)
+gpg_err_make_from_errno(gpg_err_source_t source, int err)
{
- return gpg_err_make (source, gpg_err_code_from_errno (err));
+ return gpg_err_make(source, gpg_err_code_from_errno(err));
}
static GPG_ERR_INLINE gpg_error_t
-gpg_error_from_errno (int err)
+gpg_error_from_errno(int err)
{
- return gpg_error (gpg_err_code_from_errno (err));
+ return gpg_error(gpg_err_code_from_errno(err));
}
static GPG_ERR_INLINE gpg_error_t
-gpg_error_from_syserror (void)
+gpg_error_from_syserror(void)
{
- return gpg_error (gpg_err_code_from_syserror ());
+ return gpg_error(gpg_err_code_from_syserror());
}
#ifdef __cplusplus
@@ -648,4 +646,4 @@ gpg_error_from_syserror (void)
#endif
-#endif /* GPG_ERROR_H */
+#endif /* GPG_ERROR_H */
diff --git a/winbuild/include/gpgme.h b/winbuild/include/gpgme.h
index ab92732..779940e 100644
--- a/winbuild/include/gpgme.h
+++ b/winbuild/include/gpgme.h
@@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -34,8 +34,8 @@
#include <stdio.h>
#ifdef _MSC_VER
- typedef long off_t;
- typedef long ssize_t;
+typedef long off_t;
+typedef long ssize_t;
#else
# include <sys/types.h>
#endif
@@ -57,7 +57,7 @@ extern "C" {
+ __GNUC_PATCHLEVEL__)
#if _GPGME_GCC_VERSION > 30100
-#define _GPGME_DEPRECATED __attribute__ ((__deprecated__))
+#define _GPGME_DEPRECATED __attribute__ ((__deprecated__))
#endif
#endif
@@ -96,9 +96,9 @@ typedef gpg_err_source_t gpgme_err_source_t;
static _GPGME_INLINE gpgme_error_t
-gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code)
+gpgme_err_make(gpgme_err_source_t source, gpgme_err_code_t code)
{
- return gpg_err_make (source, code);
+ return gpg_err_make(source, code);
}
@@ -109,29 +109,29 @@ gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code)
#endif
static _GPGME_INLINE gpgme_error_t
-gpgme_error (gpgme_err_code_t code)
+gpgme_error(gpgme_err_code_t code)
{
- return gpgme_err_make (GPGME_ERR_SOURCE_DEFAULT, code);
+ return gpgme_err_make(GPGME_ERR_SOURCE_DEFAULT, code);
}
static _GPGME_INLINE gpgme_err_code_t
-gpgme_err_code (gpgme_error_t err)
+gpgme_err_code(gpgme_error_t err)
{
- return gpg_err_code (err);
+ return gpg_err_code(err);
}
static _GPGME_INLINE gpgme_err_source_t
-gpgme_err_source (gpgme_error_t err)
+gpgme_err_source(gpgme_error_t err)
{
- return gpg_err_source (err);
+ return gpg_err_source(err);
}
/* Return a pointer to a string containing a description of the error
code in the error value ERR. This function is not thread safe. */
-const char *gpgme_strerror (gpgme_error_t err);
+const char *gpgme_strerror(gpgme_error_t err);
/* Return the error string for ERR in the user-supplied buffer BUF of
size BUFLEN. This function is, in contrast to gpg_strerror,
@@ -140,62 +140,59 @@ const char *gpgme_strerror (gpgme_error_t err);
contains the string describing the error. If the buffer was not
large enough, ERANGE is returned and BUF contains as much of the
beginning of the error string as fits into the buffer. */
-int gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen);
+int gpgme_strerror_r(gpg_error_t err, char *buf, size_t buflen);
/* Return a pointer to a string containing a description of the error
source in the error value ERR. */
-const char *gpgme_strsource (gpgme_error_t err);
+const char *gpgme_strsource(gpgme_error_t err);
/* Retrieve the error code for the system error ERR. This returns
GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
this). */
-gpgme_err_code_t gpgme_err_code_from_errno (int err);
+gpgme_err_code_t gpgme_err_code_from_errno(int err);
/* Retrieve the system error for the error code CODE. This returns 0
if CODE is not a system error code. */
-int gpgme_err_code_to_errno (gpgme_err_code_t code);
+int gpgme_err_code_to_errno(gpgme_err_code_t code);
+
-
/* Return an error value with the error source SOURCE and the system
error ERR. */
-gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err);
+gpgme_error_t gpgme_err_make_from_errno(gpgme_err_source_t source, int err);
/* Return an error value with the system error ERR. */
-gpgme_err_code_t gpgme_error_from_errno (int err);
+gpgme_err_code_t gpgme_error_from_errno(int err);
/* The possible encoding mode of gpgme_data_t objects. */
-typedef enum
- {
- GPGME_DATA_ENCODING_NONE = 0, /* Not specified. */
+typedef enum {
+ GPGME_DATA_ENCODING_NONE = 0, /* Not specified. */
GPGME_DATA_ENCODING_BINARY = 1,
GPGME_DATA_ENCODING_BASE64 = 2,
- GPGME_DATA_ENCODING_ARMOR = 3 /* Either PEM or OpenPGP Armor. */
- }
+ GPGME_DATA_ENCODING_ARMOR = 3 /* Either PEM or OpenPGP Armor. */
+}
gpgme_data_encoding_t;
/* Public key algorithms from libgcrypt. */
-typedef enum
- {
+typedef enum {
GPGME_PK_RSA = 1,
GPGME_PK_RSA_E = 2,
GPGME_PK_RSA_S = 3,
GPGME_PK_ELG_E = 16,
GPGME_PK_DSA = 17,
GPGME_PK_ELG = 20
- }
+}
gpgme_pubkey_algo_t;
/* Hash algorithms from libgcrypt. */
-typedef enum
- {
- GPGME_MD_NONE = 0,
+typedef enum {
+ GPGME_MD_NONE = 0,
GPGME_MD_MD5 = 1,
GPGME_MD_SHA1 = 2,
GPGME_MD_RMD160 = 3,
@@ -206,17 +203,16 @@ typedef enum
GPGME_MD_SHA384 = 9,
GPGME_MD_SHA512 = 10,
GPGME_MD_MD4 = 301,
- GPGME_MD_CRC32 = 302,
+ GPGME_MD_CRC32 = 302,
GPGME_MD_CRC32_RFC1510 = 303,
GPGME_MD_CRC24_RFC2440 = 304
- }
+}
gpgme_hash_algo_t;
/* The possible signature stati. Deprecated, use error value in sig
status. */
-typedef enum
- {
+typedef enum {
GPGME_SIG_STAT_NONE = 0,
GPGME_SIG_STAT_GOOD = 1,
GPGME_SIG_STAT_BAD = 2,
@@ -226,25 +222,23 @@ typedef enum
GPGME_SIG_STAT_DIFF = 6,
GPGME_SIG_STAT_GOOD_EXP = 7,
GPGME_SIG_STAT_GOOD_EXPKEY = 8
- }
+}
_gpgme_sig_stat_t;
typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED;
/* The available signature modes. */
-typedef enum
- {
+typedef enum {
GPGME_SIG_MODE_NORMAL = 0,
GPGME_SIG_MODE_DETACH = 1,
GPGME_SIG_MODE_CLEAR = 2
- }
+}
gpgme_sig_mode_t;
/* The available key and signature attributes. Deprecated, use the
individual result structures instead. */
-typedef enum
- {
+typedef enum {
GPGME_ATTR_KEYID = 1,
GPGME_ATTR_FPR = 2,
GPGME_ATTR_ALGO = 3,
@@ -277,39 +271,37 @@ typedef enum
GPGME_ATTR_ERRTOK = 30,
GPGME_ATTR_SIG_SUMMARY = 31,
GPGME_ATTR_SIG_CLASS = 32
- }
+}
_gpgme_attr_t;
typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED;
/* The available validities for a trust item or key. */
-typedef enum
- {
+typedef enum {
GPGME_VALIDITY_UNKNOWN = 0,
GPGME_VALIDITY_UNDEFINED = 1,
GPGME_VALIDITY_NEVER = 2,
GPGME_VALIDITY_MARGINAL = 3,
GPGME_VALIDITY_FULL = 4,
GPGME_VALIDITY_ULTIMATE = 5
- }
+}
gpgme_validity_t;
/* The available protocols. */
-typedef enum
- {
+typedef enum {
GPGME_PROTOCOL_OpenPGP = 0, /* The default mode. */
GPGME_PROTOCOL_CMS = 1
- }
+}
gpgme_protocol_t;
/* The available keylist mode flags. */
-#define GPGME_KEYLIST_MODE_LOCAL 1
-#define GPGME_KEYLIST_MODE_EXTERN 2
-#define GPGME_KEYLIST_MODE_SIGS 4
-#define GPGME_KEYLIST_MODE_SIG_NOTATIONS 8
-#define GPGME_KEYLIST_MODE_VALIDATE 256
+#define GPGME_KEYLIST_MODE_LOCAL 1
+#define GPGME_KEYLIST_MODE_EXTERN 2
+#define GPGME_KEYLIST_MODE_SIGS 4
+#define GPGME_KEYLIST_MODE_SIG_NOTATIONS 8
+#define GPGME_KEYLIST_MODE_VALIDATE 256
typedef unsigned int gpgme_keylist_mode_t;
@@ -317,46 +309,44 @@ typedef unsigned int gpgme_keylist_mode_t;
/* Signature notations. */
/* The available signature notation flags. */
-#define GPGME_SIG_NOTATION_HUMAN_READABLE 1
-#define GPGME_SIG_NOTATION_CRITICAL 2
+#define GPGME_SIG_NOTATION_HUMAN_READABLE 1
+#define GPGME_SIG_NOTATION_CRITICAL 2
typedef unsigned int gpgme_sig_notation_flags_t;
-struct _gpgme_sig_notation
-{
- struct _gpgme_sig_notation *next;
+struct _gpgme_sig_notation {
+ struct _gpgme_sig_notation *next;
- /* If NAME is a null pointer, then VALUE contains a policy URL
- rather than a notation. */
- char *name;
+ /* If NAME is a null pointer, then VALUE contains a policy URL
+ rather than a notation. */
+ char *name;
- /* The value of the notation data. */
- char *value;
+ /* The value of the notation data. */
+ char *value;
- /* The length of the name of the notation data. */
- int name_len;
+ /* The length of the name of the notation data. */
+ int name_len;
- /* The length of the value of the notation data. */
- int value_len;
+ /* The length of the value of the notation data. */
+ int value_len;
- /* The accumulated flags. */
- gpgme_sig_notation_flags_t flags;
+ /* The accumulated flags. */
+ gpgme_sig_notation_flags_t flags;
- /* Notation data is human-readable. */
- unsigned int human_readable : 1;
+ /* Notation data is human-readable. */
+ unsigned int human_readable : 1;
- /* Notation data is critical. */
- unsigned int critical : 1;
+ /* Notation data is critical. */
+ unsigned int critical : 1;
- /* Internal to GPGME, do not use. */
- int _unused : 30;
+ /* Internal to GPGME, do not use. */
+ int _unused : 30;
};
typedef struct _gpgme_sig_notation *gpgme_sig_notation_t;
/* The possible stati for the edit operation. */
-typedef enum
- {
+typedef enum {
GPGME_STATUS_EOF,
/* mkstatus processing starts here */
GPGME_STATUS_ENTER,
@@ -449,274 +439,269 @@ typedef enum
GPGME_STATUS_PKA_TRUST_GOOD,
GPGME_STATUS_PLAINTEXT
- }
+}
gpgme_status_code_t;
/* The engine information structure. */
-struct _gpgme_engine_info
-{
- struct _gpgme_engine_info *next;
+struct _gpgme_engine_info {
+ struct _gpgme_engine_info *next;
+
+ /* The protocol ID. */
+ gpgme_protocol_t protocol;
- /* The protocol ID. */
- gpgme_protocol_t protocol;
+ /* The file name of the engine binary. */
+ char *file_name;
- /* The file name of the engine binary. */
- char *file_name;
-
- /* The version string of the installed engine. */
- char *version;
+ /* The version string of the installed engine. */
+ char *version;
- /* The minimum version required for GPGME. */
- const char *req_version;
+ /* The minimum version required for GPGME. */
+ const char *req_version;
- /* The home directory used, or NULL if default. */
- char *home_dir;
+ /* The home directory used, or NULL if default. */
+ char *home_dir;
};
typedef struct _gpgme_engine_info *gpgme_engine_info_t;
/* A subkey from a key. */
-struct _gpgme_subkey
-{
- struct _gpgme_subkey *next;
+struct _gpgme_subkey {
+ struct _gpgme_subkey *next;
+
+ /* True if subkey is revoked. */
+ unsigned int revoked : 1;
- /* True if subkey is revoked. */
- unsigned int revoked : 1;
+ /* True if subkey is expired. */
+ unsigned int expired : 1;
- /* True if subkey is expired. */
- unsigned int expired : 1;
+ /* True if subkey is disabled. */
+ unsigned int disabled : 1;
- /* True if subkey is disabled. */
- unsigned int disabled : 1;
+ /* True if subkey is invalid. */
+ unsigned int invalid : 1;
- /* True if subkey is invalid. */
- unsigned int invalid : 1;
+ /* True if subkey can be used for encryption. */
+ unsigned int can_encrypt : 1;
- /* True if subkey can be used for encryption. */
- unsigned int can_encrypt : 1;
+ /* True if subkey can be used for signing. */
+ unsigned int can_sign : 1;
- /* True if subkey can be used for signing. */
- unsigned int can_sign : 1;
+ /* True if subkey can be used for certification. */
+ unsigned int can_certify : 1;
- /* True if subkey can be used for certification. */
- unsigned int can_certify : 1;
+ /* True if subkey is secret. */
+ unsigned int secret : 1;
- /* True if subkey is secret. */
- unsigned int secret : 1;
+ /* True if subkey can be used for authentication. */
+ unsigned int can_authenticate : 1;
- /* True if subkey can be used for authentication. */
- unsigned int can_authenticate : 1;
+ /* True if subkey is qualified for signatures according to German law. */
+ unsigned int is_qualified : 1;
- /* True if subkey is qualified for signatures according to German law. */
- unsigned int is_qualified : 1;
+ /* Internal to GPGME, do not use. */
+ unsigned int _unused : 22;
- /* Internal to GPGME, do not use. */
- unsigned int _unused : 22;
-
- /* Public key algorithm supported by this subkey. */
- gpgme_pubkey_algo_t pubkey_algo;
+ /* Public key algorithm supported by this subkey. */
+ gpgme_pubkey_algo_t pubkey_algo;
- /* Length of the subkey. */
- unsigned int length;
+ /* Length of the subkey. */
+ unsigned int length;
- /* The key ID of the subkey. */
- char *keyid;
+ /* The key ID of the subkey. */
+ char *keyid;
- /* Internal to GPGME, do not use. */
- char _keyid[16 + 1];
+ /* Internal to GPGME, do not use. */
+ char _keyid[16 + 1];
- /* The fingerprint of the subkey in hex digit form. */
- char *fpr;
+ /* The fingerprint of the subkey in hex digit form. */
+ char *fpr;
- /* The creation timestamp, -1 if invalid, 0 if not available. */
- long int timestamp;
+ /* The creation timestamp, -1 if invalid, 0 if not available. */
+ long int timestamp;
- /* The expiration timestamp, 0 if the subkey does not expire. */
- long int expires;
+ /* The expiration timestamp, 0 if the subkey does not expire. */
+ long int expires;
};
typedef struct _gpgme_subkey *gpgme_subkey_t;
/* A signature on a user ID. */
-struct _gpgme_key_sig
-{
- struct _gpgme_key_sig *next;
+struct _gpgme_key_sig {
+ struct _gpgme_key_sig *next;
- /* True if the signature is a revocation signature. */
- unsigned int revoked : 1;
+ /* True if the signature is a revocation signature. */
+ unsigned int revoked : 1;
- /* True if the signature is expired. */
- unsigned int expired : 1;
+ /* True if the signature is expired. */
+ unsigned int expired : 1;
- /* True if the signature is invalid. */
- unsigned int invalid : 1;
+ /* True if the signature is invalid. */
+ unsigned int invalid : 1;
- /* True if the signature should be exported. */
- unsigned int exportable : 1;
+ /* True if the signature should be exported. */
+ unsigned int exportable : 1;
- /* Internal to GPGME, do not use. */
- unsigned int _unused : 28;
+ /* Internal to GPGME, do not use. */
+ unsigned int _unused : 28;
- /* The public key algorithm used to create the signature. */
- gpgme_pubkey_algo_t pubkey_algo;
+ /* The public key algorithm used to create the signature. */
+ gpgme_pubkey_algo_t pubkey_algo;
- /* The key ID of key used to create the signature. */
- char *keyid;
+ /* The key ID of key used to create the signature. */
+ char *keyid;
- /* Internal to GPGME, do not use. */
- char _keyid[16 + 1];
+ /* Internal to GPGME, do not use. */
+ char _keyid[16 + 1];
- /* The creation timestamp, -1 if invalid, 0 if not available. */
- long int timestamp;
+ /* The creation timestamp, -1 if invalid, 0 if not available. */
+ long int timestamp;
- /* The expiration timestamp, 0 if the subkey does not expire. */
- long int expires;
+ /* The expiration timestamp, 0 if the subkey does not expire. */
+ long int expires;
- /* Same as in gpgme_signature_t. */
- gpgme_error_t status;
+ /* Same as in gpgme_signature_t. */
+ gpgme_error_t status;
#ifdef __cplusplus
- unsigned int _obsolete_class _GPGME_DEPRECATED;
+ unsigned int _obsolete_class _GPGME_DEPRECATED;
#else
- /* Must be set to SIG_CLASS below. */
- unsigned int class _GPGME_DEPRECATED;
+ /* Must be set to SIG_CLASS below. */
+ unsigned int class _GPGME_DEPRECATED;
#endif
- /* The user ID string. */
- char *uid;
+ /* The user ID string. */
+ char *uid;
- /* The name part of the user ID. */
- char *name;
+ /* The name part of the user ID. */
+ char *name;
- /* The email part of the user ID. */
- char *email;
+ /* The email part of the user ID. */
+ char *email;
- /* The comment part of the user ID. */
- char *comment;
+ /* The comment part of the user ID. */
+ char *comment;
- /* Crypto backend specific signature class. */
- unsigned int sig_class;
+ /* Crypto backend specific signature class. */
+ unsigned int sig_class;
- /* Notation data and policy URLs. */
- gpgme_sig_notation_t notations;
+ /* Notation data and policy URLs. */
+ gpgme_sig_notation_t notations;
- /* Internal to GPGME, do not use. */
- gpgme_sig_notation_t _last_notation;
+ /* Internal to GPGME, do not use. */
+ gpgme_sig_notation_t _last_notation;
};
typedef struct _gpgme_key_sig *gpgme_key_sig_t;
/* An user ID from a key. */
-struct _gpgme_user_id
-{
- struct _gpgme_user_id *next;
+struct _gpgme_user_id {
+ struct _gpgme_user_id *next;
- /* True if the user ID is revoked. */
- unsigned int revoked : 1;
+ /* True if the user ID is revoked. */
+ unsigned int revoked : 1;
- /* True if the user ID is invalid. */
- unsigned int invalid : 1;
+ /* True if the user ID is invalid. */
+ unsigned int invalid : 1;
- /* Internal to GPGME, do not use. */
- unsigned int _unused : 30;
+ /* Internal to GPGME, do not use. */
+ unsigned int _unused : 30;
- /* The validity of the user ID. */
- gpgme_validity_t validity;
+ /* The validity of the user ID. */
+ gpgme_validity_t validity;
- /* The user ID string. */
- char *uid;
+ /* The user ID string. */
+ char *uid;
- /* The name part of the user ID. */
- char *name;
+ /* The name part of the user ID. */
+ char *name;
- /* The email part of the user ID. */
- char *email;
+ /* The email part of the user ID. */
+ char *email;
- /* The comment part of the user ID. */
- char *comment;
+ /* The comment part of the user ID. */
+ char *comment;
- /* The signatures of the user ID. */
- gpgme_key_sig_t signatures;
+ /* The signatures of the user ID. */
+ gpgme_key_sig_t signatures;
- /* Internal to GPGME, do not use. */
- gpgme_key_sig_t _last_keysig;
+ /* Internal to GPGME, do not use. */
+ gpgme_key_sig_t _last_keysig;
};
typedef struct _gpgme_user_id *gpgme_user_id_t;
/* A key from the keyring. */
-struct _gpgme_key
-{
- /* Internal to GPGME, do not use. */
- unsigned int _refs;
+struct _gpgme_key {
+ /* Internal to GPGME, do not use. */
+ unsigned int _refs;
- /* True if key is revoked. */
- unsigned int revoked : 1;
+ /* True if key is revoked. */
+ unsigned int revoked : 1;
- /* True if key is expired. */
- unsigned int expired : 1;
+ /* True if key is expired. */
+ unsigned int expired : 1;
- /* True if key is disabled. */
- unsigned int disabled : 1;
+ /* True if key is disabled. */
+ unsigned int disabled : 1;
- /* True if key is invalid. */
- unsigned int invalid : 1;
+ /* True if key is invalid. */
+ unsigned int invalid : 1;
- /* True if key can be used for encryption. */
- unsigned int can_encrypt : 1;
+ /* True if key can be used for encryption. */
+ unsigned int can_encrypt : 1;
- /* True if key can be used for signing. */
- unsigned int can_sign : 1;
+ /* True if key can be used for signing. */
+ unsigned int can_sign : 1;
- /* True if key can be used for certification. */
- unsigned int can_certify : 1;
+ /* True if key can be used for certification. */
+ unsigned int can_certify : 1;
- /* True if key is secret. */
- unsigned int secret : 1;
+ /* True if key is secret. */
+ unsigned int secret : 1;
- /* True if key can be used for authentication. */
- unsigned int can_authenticate : 1;
+ /* True if key can be used for authentication. */
+ unsigned int can_authenticate : 1;
- /* True if subkey is qualified for signatures according to German law. */
- unsigned int is_qualified : 1;
+ /* True if subkey is qualified for signatures according to German law. */
+ unsigned int is_qualified : 1;
- /* Internal to GPGME, do not use. */
- unsigned int _unused : 22;
+ /* Internal to GPGME, do not use. */
+ unsigned int _unused : 22;
- /* This is the protocol supported by this key. */
- gpgme_protocol_t protocol;
+ /* This is the protocol supported by this key. */
+ gpgme_protocol_t protocol;
- /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
- issuer serial. */
- char *issuer_serial;
+ /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
+ issuer serial. */
+ char *issuer_serial;
- /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
- issuer name. */
- char *issuer_name;
+ /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
+ issuer name. */
+ char *issuer_name;
- /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain
- ID. */
- char *chain_id;
+ /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain
+ ID. */
+ char *chain_id;
- /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the
- owner trust. */
- gpgme_validity_t owner_trust;
+ /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the
+ owner trust. */
+ gpgme_validity_t owner_trust;
- /* The subkeys of the key. */
- gpgme_subkey_t subkeys;
+ /* The subkeys of the key. */
+ gpgme_subkey_t subkeys;
- /* The user IDs of the key. */
- gpgme_user_id_t uids;
+ /* The user IDs of the key. */
+ gpgme_user_id_t uids;
- /* Internal to GPGME, do not use. */
- gpgme_subkey_t _last_subkey;
+ /* Internal to GPGME, do not use. */
+ gpgme_subkey_t _last_subkey;
- /* Internal to GPGME, do not use. */
- gpgme_user_id_t _last_uid;
+ /* Internal to GPGME, do not use. */
+ gpgme_user_id_t _last_uid;
- /* The keylist mode that was active when listing the key. */
- gpgme_keylist_mode_t keylist_mode;
+ /* The keylist mode that was active when listing the key. */
+ gpgme_keylist_mode_t keylist_mode;
};
typedef struct _gpgme_key *gpgme_key_t;
@@ -725,217 +710,215 @@ typedef struct _gpgme_key *gpgme_key_t;
/* Types for callback functions. */
/* Request a passphrase from the user. */
-typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook,
- const char *uid_hint,
- const char *passphrase_info,
- int prev_was_bad, int fd);
+typedef gpgme_error_t (*gpgme_passphrase_cb_t)(void *hook,
+ const char *uid_hint,
+ const char *passphrase_info,
+ int prev_was_bad, int fd);
/* Inform the user about progress made. */
-typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what,
- int type, int current, int total);
+typedef void (*gpgme_progress_cb_t)(void *opaque, const char *what,
+ int type, int current, int total);
/* Interact with the user about an edit operation. */
-typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque,
- gpgme_status_code_t status,
- const char *args, int fd);
+typedef gpgme_error_t (*gpgme_edit_cb_t)(void *opaque,
+ gpgme_status_code_t status,
+ const char *args, int fd);
/* Context management functions. */
/* Create a new context and return it in CTX. */
-gpgme_error_t gpgme_new (gpgme_ctx_t *ctx);
+gpgme_error_t gpgme_new(gpgme_ctx_t *ctx);
/* Release the context CTX. */
-void gpgme_release (gpgme_ctx_t ctx);
+void gpgme_release(gpgme_ctx_t ctx);
/* Set the protocol to be used by CTX to PROTO. */
-gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto);
+gpgme_error_t gpgme_set_protocol(gpgme_ctx_t ctx, gpgme_protocol_t proto);
/* Get the protocol used with CTX */
-gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx);
+gpgme_protocol_t gpgme_get_protocol(gpgme_ctx_t ctx);
/* Get the string describing protocol PROTO, or NULL if invalid. */
-const char *gpgme_get_protocol_name (gpgme_protocol_t proto);
+const char *gpgme_get_protocol_name(gpgme_protocol_t proto);
/* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */
-void gpgme_set_armor (gpgme_ctx_t ctx, int yes);
+void gpgme_set_armor(gpgme_ctx_t ctx, int yes);
/* Return non-zero if armor mode is set in CTX. */
-int gpgme_get_armor (gpgme_ctx_t ctx);
+int gpgme_get_armor(gpgme_ctx_t ctx);
/* If YES is non-zero, enable text mode in CTX, disable it otherwise. */
-void gpgme_set_textmode (gpgme_ctx_t ctx, int yes);
+void gpgme_set_textmode(gpgme_ctx_t ctx, int yes);
/* Return non-zero if text mode is set in CTX. */
-int gpgme_get_textmode (gpgme_ctx_t ctx);
+int gpgme_get_textmode(gpgme_ctx_t ctx);
/* Use whatever the default of the backend crypto engine is. */
-#define GPGME_INCLUDE_CERTS_DEFAULT -256
+#define GPGME_INCLUDE_CERTS_DEFAULT -256
/* Include up to NR_OF_CERTS certificates in an S/MIME message. */
-void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs);
+void gpgme_set_include_certs(gpgme_ctx_t ctx, int nr_of_certs);
/* Return the number of certs to include in an S/MIME message. */
-int gpgme_get_include_certs (gpgme_ctx_t ctx);
+int gpgme_get_include_certs(gpgme_ctx_t ctx);
/* Set keylist mode in CTX to MODE. */
-gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx,
- gpgme_keylist_mode_t mode);
+gpgme_error_t gpgme_set_keylist_mode(gpgme_ctx_t ctx,
+ gpgme_keylist_mode_t mode);
/* Get keylist mode in CTX. */
-gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx);
+gpgme_keylist_mode_t gpgme_get_keylist_mode(gpgme_ctx_t ctx);
/* Set the passphrase callback function in CTX to CB. HOOK_VALUE is
passed as first argument to the passphrase callback function. */
-void gpgme_set_passphrase_cb (gpgme_ctx_t ctx,
- gpgme_passphrase_cb_t cb, void *hook_value);
+void gpgme_set_passphrase_cb(gpgme_ctx_t ctx,
+ gpgme_passphrase_cb_t cb, void *hook_value);
/* Get the current passphrase callback function in *CB and the current
hook value in *HOOK_VALUE. */
-void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb,
- void **hook_value);
+void gpgme_get_passphrase_cb(gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb,
+ void **hook_value);
/* Set the progress callback function in CTX to CB. HOOK_VALUE is
passed as first argument to the progress callback function. */
-void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb,
- void *hook_value);
+void gpgme_set_progress_cb(gpgme_ctx_t c, gpgme_progress_cb_t cb,
+ void *hook_value);
/* Get the current progress callback function in *CB and the current
hook value in *HOOK_VALUE. */
-void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb,
- void **hook_value);
+void gpgme_get_progress_cb(gpgme_ctx_t ctx, gpgme_progress_cb_t *cb,
+ void **hook_value);
/* This function sets the locale for the context CTX, or the default
locale if CTX is a null pointer. */
-gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category,
- const char *value);
+gpgme_error_t gpgme_set_locale(gpgme_ctx_t ctx, int category,
+ const char *value);
/* Get the information about the configured engines. A pointer to the
first engine in the statically allocated linked list is returned.
The returned data is valid until the next gpgme_ctx_set_engine_info. */
-gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx);
+gpgme_engine_info_t gpgme_ctx_get_engine_info(gpgme_ctx_t ctx);
/* Set the engine info for the context CTX, protocol PROTO, to the
file name FILE_NAME and the home directory HOME_DIR. */
-gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx,
- gpgme_protocol_t proto,
- const char *file_name,
- const char *home_dir);
+gpgme_error_t gpgme_ctx_set_engine_info(gpgme_ctx_t ctx,
+ gpgme_protocol_t proto,
+ const char *file_name,
+ const char *home_dir);
/* Return a statically allocated string with the name of the public
key algorithm ALGO, or NULL if that name is not known. */
-const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo);
+const char *gpgme_pubkey_algo_name(gpgme_pubkey_algo_t algo);
/* Return a statically allocated string with the name of the hash
algorithm ALGO, or NULL if that name is not known. */
-const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo);
+const char *gpgme_hash_algo_name(gpgme_hash_algo_t algo);
/* Delete all signers from CTX. */
-void gpgme_signers_clear (gpgme_ctx_t ctx);
+void gpgme_signers_clear(gpgme_ctx_t ctx);
/* Add KEY to list of signers in CTX. */
-gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key);
+gpgme_error_t gpgme_signers_add(gpgme_ctx_t ctx, const gpgme_key_t key);
/* Return the SEQth signer's key in CTX. */
-gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq);
+gpgme_key_t gpgme_signers_enum(const gpgme_ctx_t ctx, int seq);
/* Retrieve the signature status of signature IDX in CTX after a
successful verify operation in R_STAT (if non-null). The creation
time stamp of the signature is returned in R_CREATED (if non-null).
The function returns a string containing the fingerprint.
Deprecated, use verify result directly. */
-const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx,
- _gpgme_sig_stat_t *r_stat,
- time_t *r_created) _GPGME_DEPRECATED;
+const char *gpgme_get_sig_status(gpgme_ctx_t ctx, int idx,
+ _gpgme_sig_stat_t *r_stat,
+ time_t *r_created) _GPGME_DEPRECATED;
/* Retrieve certain attributes of a signature. IDX is the index
number of the signature after a successful verify operation. WHAT
is an attribute where GPGME_ATTR_EXPIRE is probably the most useful
one. WHATIDX is to be passed as 0 for most attributes . */
-unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx,
- _gpgme_attr_t what, int whatidx)
- _GPGME_DEPRECATED;
-const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx,
- _gpgme_attr_t what, int whatidx)
- _GPGME_DEPRECATED;
+unsigned long gpgme_get_sig_ulong_attr(gpgme_ctx_t c, int idx,
+ _gpgme_attr_t what, int whatidx)
+_GPGME_DEPRECATED;
+const char *gpgme_get_sig_string_attr(gpgme_ctx_t c, int idx,
+ _gpgme_attr_t what, int whatidx)
+_GPGME_DEPRECATED;
/* Get the key used to create signature IDX in CTX and return it in
R_KEY. */
-gpgme_error_t gpgme_get_sig_key (gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key)
- _GPGME_DEPRECATED;
+gpgme_error_t gpgme_get_sig_key(gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key)
+_GPGME_DEPRECATED;
/* Clear all notation data from the context. */
-void gpgme_sig_notation_clear (gpgme_ctx_t ctx);
+void gpgme_sig_notation_clear(gpgme_ctx_t ctx);
/* Add the human-readable notation data with name NAME and value VALUE
to the context CTX, using the flags FLAGS. If NAME is NULL, then
VALUE should be a policy URL. The flag
GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation
data, and false for policy URLs. */
-gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
- const char *value,
- gpgme_sig_notation_flags_t flags);
+gpgme_error_t gpgme_sig_notation_add(gpgme_ctx_t ctx, const char *name,
+ const char *value,
+ gpgme_sig_notation_flags_t flags);
/* Get the sig notations for this context. */
-gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx);
+gpgme_sig_notation_t gpgme_sig_notation_get(gpgme_ctx_t ctx);
/* Run control. */
/* The type of an I/O callback function. */
-typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd);
+typedef gpgme_error_t (*gpgme_io_cb_t)(void *data, int fd);
/* The type of a function that can register FNC as the I/O callback
function for the file descriptor FD with direction dir (0: for writing,
1: for reading). FNC_DATA should be passed as DATA to FNC. The
function should return a TAG suitable for the corresponding
gpgme_remove_io_cb_t, and an error value. */
-typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir,
- gpgme_io_cb_t fnc,
- void *fnc_data, void **tag);
+typedef gpgme_error_t (*gpgme_register_io_cb_t)(void *data, int fd, int dir,
+ gpgme_io_cb_t fnc,
+ void *fnc_data, void **tag);
/* The type of a function that can remove a previously registered I/O
callback function given TAG as returned by the register
function. */
-typedef void (*gpgme_remove_io_cb_t) (void *tag);
+typedef void (*gpgme_remove_io_cb_t)(void *tag);
-typedef enum
- {
+typedef enum {
GPGME_EVENT_START,
GPGME_EVENT_DONE,
GPGME_EVENT_NEXT_KEY,
GPGME_EVENT_NEXT_TRUSTITEM
- }
+}
gpgme_event_io_t;
/* The type of a function that is called when a context finished an
operation. */
-typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type,
- void *type_data);
-
-struct gpgme_io_cbs
-{
- gpgme_register_io_cb_t add;
- void *add_priv;
- gpgme_remove_io_cb_t remove;
- gpgme_event_io_cb_t event;
- void *event_priv;
+typedef void (*gpgme_event_io_cb_t)(void *data, gpgme_event_io_t type,
+ void *type_data);
+
+struct gpgme_io_cbs {
+ gpgme_register_io_cb_t add;
+ void *add_priv;
+ gpgme_remove_io_cb_t remove;
+ gpgme_event_io_cb_t event;
+ void *event_priv;
};
typedef struct gpgme_io_cbs *gpgme_io_cbs_t;
/* Set the I/O callback functions in CTX to IO_CBS. */
-void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
+void gpgme_set_io_cbs(gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
/* Get the current I/O callback functions. */
-void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
+void gpgme_get_io_cbs(gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
/* Process the pending operation and, if HANG is non-zero, wait for
the pending operation to finish. */
-gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
+gpgme_ctx_t gpgme_wait(gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
/* Functions to handle data objects. */
@@ -943,344 +926,335 @@ gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle HANDLE. Return the number of characters read, 0 on EOF
and -1 on error. If an error occurs, errno is set. */
-typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer,
- size_t size);
+typedef ssize_t (*gpgme_data_read_cb_t)(void *handle, void *buffer,
+ size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle HANDLE. Return the number of characters written, or -1
on error. If an error occurs, errno is set. */
-typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
- size_t size);
+typedef ssize_t (*gpgme_data_write_cb_t)(void *handle, const void *buffer,
+ size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle HANDLE to OFFSET, relativ to
WHENCE. */
-typedef off_t (*gpgme_data_seek_cb_t) (void *handle, off_t offset, int whence);
+typedef off_t(*gpgme_data_seek_cb_t)(void *handle, off_t offset, int whence);
/* Close the data object with the handle DL. */
-typedef void (*gpgme_data_release_cb_t) (void *handle);
+typedef void (*gpgme_data_release_cb_t)(void *handle);
-struct gpgme_data_cbs
-{
- gpgme_data_read_cb_t read;
- gpgme_data_write_cb_t write;
- gpgme_data_seek_cb_t seek;
- gpgme_data_release_cb_t release;
+struct gpgme_data_cbs {
+ gpgme_data_read_cb_t read;
+ gpgme_data_write_cb_t write;
+ gpgme_data_seek_cb_t seek;
+ gpgme_data_release_cb_t release;
};
typedef struct gpgme_data_cbs *gpgme_data_cbs_t;
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
-ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
+ssize_t gpgme_data_read(gpgme_data_t dh, void *buffer, size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
-ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
+ssize_t gpgme_data_write(gpgme_data_t dh, const void *buffer, size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
-off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence);
+off_t gpgme_data_seek(gpgme_data_t dh, off_t offset, int whence);
/* Create a new data buffer and return it in R_DH. */
-gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh);
+gpgme_error_t gpgme_data_new(gpgme_data_t *r_dh);
/* Destroy the data buffer DH. */
-void gpgme_data_release (gpgme_data_t dh);
+void gpgme_data_release(gpgme_data_t dh);
/* Create a new data buffer filled with SIZE bytes starting from
BUFFER. If COPY is zero, copying is delayed until necessary, and
the data is taken from the original location when needed. */
-gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh,
- const char *buffer, size_t size,
- int copy);
+gpgme_error_t gpgme_data_new_from_mem(gpgme_data_t *r_dh,
+ const char *buffer, size_t size,
+ int copy);
/* Destroy the data buffer DH and return a pointer to its content.
The memory has be to released with gpgme_free() by the user. It's
size is returned in R_LEN. */
-char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len);
+char *gpgme_data_release_and_get_mem(gpgme_data_t dh, size_t *r_len);
/* Release the memory returned by gpgme_data_release_and_get_mem(). */
-void gpgme_free (void *buffer);
+void gpgme_free(void *buffer);
-gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh,
- gpgme_data_cbs_t cbs,
- void *handle);
+gpgme_error_t gpgme_data_new_from_cbs(gpgme_data_t *dh,
+ gpgme_data_cbs_t cbs,
+ void *handle);
-gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd);
+gpgme_error_t gpgme_data_new_from_fd(gpgme_data_t *dh, int fd);
-gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream);
+gpgme_error_t gpgme_data_new_from_stream(gpgme_data_t *dh, FILE *stream);
/* Return the encoding attribute of the data buffer DH */
-gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh);
+gpgme_data_encoding_t gpgme_data_get_encoding(gpgme_data_t dh);
/* Set the encoding attribute of data buffer DH to ENC */
-gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh,
- gpgme_data_encoding_t enc);
+gpgme_error_t gpgme_data_set_encoding(gpgme_data_t dh,
+ gpgme_data_encoding_t enc);
/* Get the file name associated with the data object with handle DH, or
NULL if there is none. */
-char *gpgme_data_get_file_name (gpgme_data_t dh);
+char *gpgme_data_get_file_name(gpgme_data_t dh);
/* Set the file name associated with the data object with handle DH to
FILE_NAME. */
-gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
- const char *file_name);
+gpgme_error_t gpgme_data_set_file_name(gpgme_data_t dh,
+ const char *file_name);
/* Create a new data buffer which retrieves the data from the callback
function READ_CB. Deprecated, please use gpgme_data_new_from_cbs
instead. */
-gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh,
- int (*read_cb) (void*,char *,
- size_t,size_t*),
- void *read_cb_value)
- _GPGME_DEPRECATED;
+gpgme_error_t gpgme_data_new_with_read_cb(gpgme_data_t *r_dh,
+ int (*read_cb)(void*, char *,
+ size_t, size_t*),
+ void *read_cb_value)
+_GPGME_DEPRECATED;
/* Create a new data buffer filled with the content of file FNAME.
COPY must be non-zero. For delayed read, please use
gpgme_data_new_from_fd or gpgme_data_new_from stream instead. */
-gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh,
- const char *fname,
- int copy);
+gpgme_error_t gpgme_data_new_from_file(gpgme_data_t *r_dh,
+ const char *fname,
+ int copy);
/* Create a new data buffer filled with LENGTH bytes starting from
OFFSET within the file FNAME or stream FP (exactly one must be
non-zero). */
-gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh,
- const char *fname, FILE *fp,
- off_t offset, size_t length);
+gpgme_error_t gpgme_data_new_from_filepart(gpgme_data_t *r_dh,
+ const char *fname, FILE *fp,
+ off_t offset, size_t length);
/* Reset the read pointer in DH. Deprecated, please use
gpgme_data_seek instead. */
-gpgme_error_t gpgme_data_rewind (gpgme_data_t dh) _GPGME_DEPRECATED;
+gpgme_error_t gpgme_data_rewind(gpgme_data_t dh) _GPGME_DEPRECATED;
/* Key and trust functions. */
/* Get the key with the fingerprint FPR from the crypto backend. If
SECRET is true, get the secret key. */
-gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr,
- gpgme_key_t *r_key, int secret);
+gpgme_error_t gpgme_get_key(gpgme_ctx_t ctx, const char *fpr,
+ gpgme_key_t *r_key, int secret);
/* Acquire a reference to KEY. */
-void gpgme_key_ref (gpgme_key_t key);
+void gpgme_key_ref(gpgme_key_t key);
/* Release a reference to KEY. If this was the last one the key is
destroyed. */
-void gpgme_key_unref (gpgme_key_t key);
-void gpgme_key_release (gpgme_key_t key);
+void gpgme_key_unref(gpgme_key_t key);
+void gpgme_key_release(gpgme_key_t key);
/* Return the value of the attribute WHAT of KEY, which has to be
representable by a string. IDX specifies the sub key or user ID
for attributes related to sub keys or user IDs. Deprecated, use
key structure directly instead. */
-const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what,
- const void *reserved, int idx)
- _GPGME_DEPRECATED;
+const char *gpgme_key_get_string_attr(gpgme_key_t key, _gpgme_attr_t what,
+ const void *reserved, int idx)
+_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of KEY, which has to be
representable by an unsigned integer. IDX specifies the sub key or
user ID for attributes related to sub keys or user IDs.
Deprecated, use key structure directly instead. */
-unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what,
- const void *reserved, int idx)
- _GPGME_DEPRECATED;
+unsigned long gpgme_key_get_ulong_attr(gpgme_key_t key, _gpgme_attr_t what,
+ const void *reserved, int idx)
+_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of a signature on user ID
UID_IDX in KEY, which has to be representable by a string. IDX
specifies the signature. Deprecated, use key structure directly
instead. */
-const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx,
- _gpgme_attr_t what,
- const void *reserved, int idx)
- _GPGME_DEPRECATED;
+const char *gpgme_key_sig_get_string_attr(gpgme_key_t key, int uid_idx,
+ _gpgme_attr_t what,
+ const void *reserved, int idx)
+_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of a signature on user ID
UID_IDX in KEY, which has to be representable by an unsigned
integer string. IDX specifies the signature. Deprecated, use key
structure directly instead. */
-unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx,
- _gpgme_attr_t what,
- const void *reserved, int idx)
- _GPGME_DEPRECATED;
+unsigned long gpgme_key_sig_get_ulong_attr(gpgme_key_t key, int uid_idx,
+ _gpgme_attr_t what,
+ const void *reserved, int idx)
+_GPGME_DEPRECATED;
/* Crypto Operations. */
/* Cancel a pending asynchronous operation. */
-gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx);
+gpgme_error_t gpgme_cancel(gpgme_ctx_t ctx);
-struct _gpgme_invalid_key
-{
- struct _gpgme_invalid_key *next;
- char *fpr;
- gpgme_error_t reason;
+struct _gpgme_invalid_key {
+ struct _gpgme_invalid_key *next;
+ char *fpr;
+ gpgme_error_t reason;
};
typedef struct _gpgme_invalid_key *gpgme_invalid_key_t;
/* Encryption. */
-struct _gpgme_op_encrypt_result
-{
- /* The list of invalid recipients. */
- gpgme_invalid_key_t invalid_recipients;
+struct _gpgme_op_encrypt_result {
+ /* The list of invalid recipients. */
+ gpgme_invalid_key_t invalid_recipients;
};
typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t;
/* Retrieve a pointer to the result of the encrypt operation. */
-gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx);
+gpgme_encrypt_result_t gpgme_op_encrypt_result(gpgme_ctx_t ctx);
/* The valid encryption flags. */
-typedef enum
- {
+typedef enum {
GPGME_ENCRYPT_ALWAYS_TRUST = 1
- }
+}
gpgme_encrypt_flags_t;
/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
store the resulting ciphertext in CIPHER. */
-gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
- gpgme_encrypt_flags_t flags,
- gpgme_data_t plain, gpgme_data_t cipher);
-gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[],
- gpgme_encrypt_flags_t flags,
- gpgme_data_t plain, gpgme_data_t cipher);
+gpgme_error_t gpgme_op_encrypt_start(gpgme_ctx_t ctx, gpgme_key_t recp[],
+ gpgme_encrypt_flags_t flags,
+ gpgme_data_t plain, gpgme_data_t cipher);
+gpgme_error_t gpgme_op_encrypt(gpgme_ctx_t ctx, gpgme_key_t recp[],
+ gpgme_encrypt_flags_t flags,
+ gpgme_data_t plain, gpgme_data_t cipher);
/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
store the resulting ciphertext in CIPHER. Also sign the ciphertext
with the signers in CTX. */
-gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx,
- gpgme_key_t recp[],
- gpgme_encrypt_flags_t flags,
- gpgme_data_t plain,
- gpgme_data_t cipher);
-gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[],
- gpgme_encrypt_flags_t flags,
- gpgme_data_t plain, gpgme_data_t cipher);
+gpgme_error_t gpgme_op_encrypt_sign_start(gpgme_ctx_t ctx,
+ gpgme_key_t recp[],
+ gpgme_encrypt_flags_t flags,
+ gpgme_data_t plain,
+ gpgme_data_t cipher);
+gpgme_error_t gpgme_op_encrypt_sign(gpgme_ctx_t ctx, gpgme_key_t recp[],
+ gpgme_encrypt_flags_t flags,
+ gpgme_data_t plain, gpgme_data_t cipher);
/* Decryption. */
-struct _gpgme_recipient
-{
- struct _gpgme_recipient *next;
+struct _gpgme_recipient {
+ struct _gpgme_recipient *next;
- /* The key ID of key for which the text was encrypted. */
- char *keyid;
+ /* The key ID of key for which the text was encrypted. */
+ char *keyid;
- /* Internal to GPGME, do not use. */
- char _keyid[16 + 1];
+ /* Internal to GPGME, do not use. */
+ char _keyid[16 + 1];
- /* The public key algorithm of the recipient key. */
- gpgme_pubkey_algo_t pubkey_algo;
+ /* The public key algorithm of the recipient key. */
+ gpgme_pubkey_algo_t pubkey_algo;
- /* The status of the recipient. */
- gpgme_error_t status;
+ /* The status of the recipient. */
+ gpgme_error_t status;
};
typedef struct _gpgme_recipient *gpgme_recipient_t;
-struct _gpgme_op_decrypt_result
-{
- char *unsupported_algorithm;
+struct _gpgme_op_decrypt_result {
+ char *unsupported_algorithm;
- /* Key should not have been used for encryption. */
- unsigned int wrong_key_usage : 1;
+ /* Key should not have been used for encryption. */
+ unsigned int wrong_key_usage : 1;
- /* Internal to GPGME, do not use. */
- int _unused : 31;
+ /* Internal to GPGME, do not use. */
+ int _unused : 31;
- gpgme_recipient_t recipients;
+ gpgme_recipient_t recipients;
- /* The original file name of the plaintext message, if
- available. */
- char *file_name;
+ /* The original file name of the plaintext message, if
+ available. */
+ char *file_name;
};
typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t;
/* Retrieve a pointer to the result of the decrypt operation. */
-gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx);
+gpgme_decrypt_result_t gpgme_op_decrypt_result(gpgme_ctx_t ctx);
/* Decrypt ciphertext CIPHER within CTX and store the resulting
plaintext in PLAIN. */
-gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
- gpgme_data_t plain);
-gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx,
- gpgme_data_t cipher, gpgme_data_t plain);
+gpgme_error_t gpgme_op_decrypt_start(gpgme_ctx_t ctx, gpgme_data_t cipher,
+ gpgme_data_t plain);
+gpgme_error_t gpgme_op_decrypt(gpgme_ctx_t ctx,
+ gpgme_data_t cipher, gpgme_data_t plain);
/* Decrypt ciphertext CIPHER and make a signature verification within
CTX and store the resulting plaintext in PLAIN. */
-gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx,
- gpgme_data_t cipher,
- gpgme_data_t plain);
-gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher,
- gpgme_data_t plain);
+gpgme_error_t gpgme_op_decrypt_verify_start(gpgme_ctx_t ctx,
+ gpgme_data_t cipher,
+ gpgme_data_t plain);
+gpgme_error_t gpgme_op_decrypt_verify(gpgme_ctx_t ctx, gpgme_data_t cipher,
+ gpgme_data_t plain);
/* Signing. */
-struct _gpgme_new_signature
-{
- struct _gpgme_new_signature *next;
+struct _gpgme_new_signature {
+ struct _gpgme_new_signature *next;
- /* The type of the signature. */
- gpgme_sig_mode_t type;
+ /* The type of the signature. */
+ gpgme_sig_mode_t type;
- /* The public key algorithm used to create the signature. */
- gpgme_pubkey_algo_t pubkey_algo;
+ /* The public key algorithm used to create the signature. */
+ gpgme_pubkey_algo_t pubkey_algo;
- /* The hash algorithm used to create the signature. */
- gpgme_hash_algo_t hash_algo;
+ /* The hash algorithm used to create the signature. */
+ gpgme_hash_algo_t hash_algo;
- /* Internal to GPGME, do not use. Must be set to the same value as
- CLASS below. */
- unsigned long _obsolete_class;
+ /* Internal to GPGME, do not use. Must be set to the same value as
+ CLASS below. */
+ unsigned long _obsolete_class;
- /* Signature creation time. */
- long int timestamp;
+ /* Signature creation time. */
+ long int timestamp;
- /* The fingerprint of the signature. */
- char *fpr;
+ /* The fingerprint of the signature. */
+ char *fpr;
#ifdef __cplusplus
- unsigned int _obsolete_class_2;
+ unsigned int _obsolete_class_2;
#else
- /* Must be set to SIG_CLASS below. */
- unsigned int class _GPGME_DEPRECATED;
+ /* Must be set to SIG_CLASS below. */
+ unsigned int class _GPGME_DEPRECATED;
#endif
- /* Crypto backend specific signature class. */
- unsigned int sig_class;
+ /* Crypto backend specific signature class. */
+ unsigned int sig_class;
};
typedef struct _gpgme_new_signature *gpgme_new_signature_t;
-struct _gpgme_op_sign_result
-{
- /* The list of invalid signers. */
- gpgme_invalid_key_t invalid_signers;
- gpgme_new_signature_t signatures;
+struct _gpgme_op_sign_result {
+ /* The list of invalid signers. */
+ gpgme_invalid_key_t invalid_signers;
+ gpgme_new_signature_t signatures;
};
typedef struct _gpgme_op_sign_result *gpgme_sign_result_t;
/* Retrieve a pointer to the result of the signing operation. */
-gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx);
+gpgme_sign_result_t gpgme_op_sign_result(gpgme_ctx_t ctx);
/* Sign the plaintext PLAIN and store the signature in SIG. */
-gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx,
- gpgme_data_t plain, gpgme_data_t sig,
- gpgme_sig_mode_t mode);
-gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx,
- gpgme_data_t plain, gpgme_data_t sig,
- gpgme_sig_mode_t mode);
+gpgme_error_t gpgme_op_sign_start(gpgme_ctx_t ctx,
+ gpgme_data_t plain, gpgme_data_t sig,
+ gpgme_sig_mode_t mode);
+gpgme_error_t gpgme_op_sign(gpgme_ctx_t ctx,
+ gpgme_data_t plain, gpgme_data_t sig,
+ gpgme_sig_mode_t mode);
/* Verify. */
/* Flags used for the SUMMARY field in a gpgme_signature_t. */
-typedef enum
- {
+typedef enum {
GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid. */
GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */
GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */
@@ -1292,372 +1266,365 @@ typedef enum
GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */
GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */
GPGME_SIGSUM_SYS_ERROR = 0x0800 /* A system error occured. */
- }
+}
gpgme_sigsum_t;
-struct _gpgme_signature
-{
- struct _gpgme_signature *next;
+struct _gpgme_signature {
+ struct _gpgme_signature *next;
- /* A summary of the signature status. */
- gpgme_sigsum_t summary;
+ /* A summary of the signature status. */
+ gpgme_sigsum_t summary;
- /* The fingerprint or key ID of the signature. */
- char *fpr;
+ /* The fingerprint or key ID of the signature. */
+ char *fpr;
- /* The status of the signature. */
- gpgme_error_t status;
+ /* The status of the signature. */
+ gpgme_error_t status;
- /* Notation data and policy URLs. */
- gpgme_sig_notation_t notations;
+ /* Notation data and policy URLs. */
+ gpgme_sig_notation_t notations;
- /* Signature creation time. */
- unsigned long timestamp;
+ /* Signature creation time. */
+ unsigned long timestamp;
- /* Signature exipration time or 0. */
- unsigned long exp_timestamp;
+ /* Signature exipration time or 0. */
+ unsigned long exp_timestamp;
- /* Key should not have been used for signing. */
- unsigned int wrong_key_usage : 1;
+ /* Key should not have been used for signing. */
+ unsigned int wrong_key_usage : 1;
- /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */
- unsigned int pka_trust : 2;
+ /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */
+ unsigned int pka_trust : 2;
- /* Internal to GPGME, do not use. */
- int _unused : 29;
+ /* Internal to GPGME, do not use. */
+ int _unused : 29;
- gpgme_validity_t validity;
- gpgme_error_t validity_reason;
+ gpgme_validity_t validity;
+ gpgme_error_t validity_reason;
- /* The public key algorithm used to create the signature. */
- gpgme_pubkey_algo_t pubkey_algo;
+ /* The public key algorithm used to create the signature. */
+ gpgme_pubkey_algo_t pubkey_algo;
- /* The hash algorithm used to create the signature. */
- gpgme_hash_algo_t hash_algo;
+ /* The hash algorithm used to create the signature. */
+ gpgme_hash_algo_t hash_algo;
- /* The mailbox from the PKA information or NULL. */
- char *pka_address;
+ /* The mailbox from the PKA information or NULL. */
+ char *pka_address;
};
typedef struct _gpgme_signature *gpgme_signature_t;
-struct _gpgme_op_verify_result
-{
- gpgme_signature_t signatures;
+struct _gpgme_op_verify_result {
+ gpgme_signature_t signatures;
- /* The original file name of the plaintext message, if
- available. */
- char *file_name;
+ /* The original file name of the plaintext message, if
+ available. */
+ char *file_name;
};
typedef struct _gpgme_op_verify_result *gpgme_verify_result_t;
/* Retrieve a pointer to the result of the verify operation. */
-gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx);
+gpgme_verify_result_t gpgme_op_verify_result(gpgme_ctx_t ctx);
/* Verify within CTX that SIG is a valid signature for TEXT. */
-gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig,
- gpgme_data_t signed_text,
- gpgme_data_t plaintext);
-gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig,
- gpgme_data_t signed_text,
- gpgme_data_t plaintext);
+gpgme_error_t gpgme_op_verify_start(gpgme_ctx_t ctx, gpgme_data_t sig,
+ gpgme_data_t signed_text,
+ gpgme_data_t plaintext);
+gpgme_error_t gpgme_op_verify(gpgme_ctx_t ctx, gpgme_data_t sig,
+ gpgme_data_t signed_text,
+ gpgme_data_t plaintext);
/* Import. */
/* The key was new. */
-#define GPGME_IMPORT_NEW 1
+#define GPGME_IMPORT_NEW 1
/* The key contained new user IDs. */
-#define GPGME_IMPORT_UID 2
+#define GPGME_IMPORT_UID 2
/* The key contained new signatures. */
-#define GPGME_IMPORT_SIG 4
+#define GPGME_IMPORT_SIG 4
/* The key contained new sub keys. */
-#define GPGME_IMPORT_SUBKEY 8
+#define GPGME_IMPORT_SUBKEY 8
/* The key contained a secret key. */
-#define GPGME_IMPORT_SECRET 16
+#define GPGME_IMPORT_SECRET 16
-struct _gpgme_import_status
-{
- struct _gpgme_import_status *next;
+struct _gpgme_import_status {
+ struct _gpgme_import_status *next;
- /* Fingerprint. */
- char *fpr;
+ /* Fingerprint. */
+ char *fpr;
- /* If a problem occured, the reason why the key could not be
- imported. Otherwise GPGME_No_Error. */
- gpgme_error_t result;
+ /* If a problem occured, the reason why the key could not be
+ imported. Otherwise GPGME_No_Error. */
+ gpgme_error_t result;
- /* The result of the import, the GPGME_IMPORT_* values bit-wise
- ORed. 0 means the key was already known and no new components
- have been added. */
- unsigned int status;
+ /* The result of the import, the GPGME_IMPORT_* values bit-wise
+ ORed. 0 means the key was already known and no new components
+ have been added. */
+ unsigned int status;
};
typedef struct _gpgme_import_status *gpgme_import_status_t;
/* Import. */
-struct _gpgme_op_import_result
-{
- /* Number of considered keys. */
- int considered;
+struct _gpgme_op_import_result {
+ /* Number of considered keys. */
+ int considered;
- /* Keys without user ID. */
- int no_user_id;
+ /* Keys without user ID. */
+ int no_user_id;
- /* Imported keys. */
- int imported;
+ /* Imported keys. */
+ int imported;
- /* Imported RSA keys. */
- int imported_rsa;
+ /* Imported RSA keys. */
+ int imported_rsa;
- /* Unchanged keys. */
- int unchanged;
+ /* Unchanged keys. */
+ int unchanged;
- /* Number of new user ids. */
- int new_user_ids;
+ /* Number of new user ids. */
+ int new_user_ids;
- /* Number of new sub keys. */
- int new_sub_keys;
+ /* Number of new sub keys. */
+ int new_sub_keys;
- /* Number of new signatures. */
- int new_signatures;
+ /* Number of new signatures. */
+ int new_signatures;
- /* Number of new revocations. */
- int new_revocations;
+ /* Number of new revocations. */
+ int new_revocations;
- /* Number of secret keys read. */
- int secret_read;
+ /* Number of secret keys read. */
+ int secret_read;
- /* Number of secret keys imported. */
- int secret_imported;
+ /* Number of secret keys imported. */
+ int secret_imported;
- /* Number of secret keys unchanged. */
- int secret_unchanged;
+ /* Number of secret keys unchanged. */
+ int secret_unchanged;
- /* Number of new keys skipped. */
- int skipped_new_keys;
+ /* Number of new keys skipped. */
+ int skipped_new_keys;
- /* Number of keys not imported. */
- int not_imported;
+ /* Number of keys not imported. */
+ int not_imported;
- /* List of keys for which an import was attempted. */
- gpgme_import_status_t imports;
+ /* List of keys for which an import was attempted. */
+ gpgme_import_status_t imports;
};
typedef struct _gpgme_op_import_result *gpgme_import_result_t;
/* Retrieve a pointer to the result of the import operation. */
-gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx);
+gpgme_import_result_t gpgme_op_import_result(gpgme_ctx_t ctx);
/* Import the key in KEYDATA into the keyring. */
-gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata);
-gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata);
-gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata,
- int *nr) _GPGME_DEPRECATED;
+gpgme_error_t gpgme_op_import_start(gpgme_ctx_t ctx, gpgme_data_t keydata);
+gpgme_error_t gpgme_op_import(gpgme_ctx_t ctx, gpgme_data_t keydata);
+gpgme_error_t gpgme_op_import_ext(gpgme_ctx_t ctx, gpgme_data_t keydata,
+ int *nr) _GPGME_DEPRECATED;
/* Export the keys found by PATTERN into KEYDATA. */
-gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern,
- unsigned int reserved,
- gpgme_data_t keydata);
-gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern,
- unsigned int reserved, gpgme_data_t keydata);
-
-gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx,
- const char *pattern[],
- unsigned int reserved,
- gpgme_data_t keydata);
-gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
- unsigned int reserved,
- gpgme_data_t keydata);
+gpgme_error_t gpgme_op_export_start(gpgme_ctx_t ctx, const char *pattern,
+ unsigned int reserved,
+ gpgme_data_t keydata);
+gpgme_error_t gpgme_op_export(gpgme_ctx_t ctx, const char *pattern,
+ unsigned int reserved, gpgme_data_t keydata);
+
+gpgme_error_t gpgme_op_export_ext_start(gpgme_ctx_t ctx,
+ const char *pattern[],
+ unsigned int reserved,
+ gpgme_data_t keydata);
+gpgme_error_t gpgme_op_export_ext(gpgme_ctx_t ctx, const char *pattern[],
+ unsigned int reserved,
+ gpgme_data_t keydata);
/* Key generation. */
-struct _gpgme_op_genkey_result
-{
- /* A primary key was generated. */
- unsigned int primary : 1;
+struct _gpgme_op_genkey_result {
+ /* A primary key was generated. */
+ unsigned int primary : 1;
- /* A sub key was generated. */
- unsigned int sub : 1;
+ /* A sub key was generated. */
+ unsigned int sub : 1;
- /* Internal to GPGME, do not use. */
- unsigned int _unused : 30;
+ /* Internal to GPGME, do not use. */
+ unsigned int _unused : 30;
- /* The fingerprint of the generated key. */
- char *fpr;
+ /* The fingerprint of the generated key. */
+ char *fpr;
};
typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t;
/* Generate a new keypair and add it to the keyring. PUBKEY and
SECKEY should be null for now. PARMS specifies what keys should be
generated. */
-gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms,
- gpgme_data_t pubkey, gpgme_data_t seckey);
-gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms,
- gpgme_data_t pubkey, gpgme_data_t seckey);
+gpgme_error_t gpgme_op_genkey_start(gpgme_ctx_t ctx, const char *parms,
+ gpgme_data_t pubkey, gpgme_data_t seckey);
+gpgme_error_t gpgme_op_genkey(gpgme_ctx_t ctx, const char *parms,
+ gpgme_data_t pubkey, gpgme_data_t seckey);
/* Retrieve a pointer to the result of the genkey operation. */
-gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx);
+gpgme_genkey_result_t gpgme_op_genkey_result(gpgme_ctx_t ctx);
/* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret
keys are also deleted. */
-gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key,
- int allow_secret);
-gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key,
- int allow_secret);
+gpgme_error_t gpgme_op_delete_start(gpgme_ctx_t ctx, const gpgme_key_t key,
+ int allow_secret);
+gpgme_error_t gpgme_op_delete(gpgme_ctx_t ctx, const gpgme_key_t key,
+ int allow_secret);
/* Edit the key KEY. Send status and command requests to FNC and
output of edit commands to OUT. */
-gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
- gpgme_edit_cb_t fnc, void *fnc_value,
- gpgme_data_t out);
-gpgme_error_t gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,
- gpgme_edit_cb_t fnc, void *fnc_value,
- gpgme_data_t out);
+gpgme_error_t gpgme_op_edit_start(gpgme_ctx_t ctx, gpgme_key_t key,
+ gpgme_edit_cb_t fnc, void *fnc_value,
+ gpgme_data_t out);
+gpgme_error_t gpgme_op_edit(gpgme_ctx_t ctx, gpgme_key_t key,
+ gpgme_edit_cb_t fnc, void *fnc_value,
+ gpgme_data_t out);
/* Edit the card for the key KEY. Send status and command requests to
FNC and output of edit commands to OUT. */
-gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
- gpgme_edit_cb_t fnc, void *fnc_value,
- gpgme_data_t out);
-gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key,
- gpgme_edit_cb_t fnc, void *fnc_value,
- gpgme_data_t out);
+gpgme_error_t gpgme_op_card_edit_start(gpgme_ctx_t ctx, gpgme_key_t key,
+ gpgme_edit_cb_t fnc, void *fnc_value,
+ gpgme_data_t out);
+gpgme_error_t gpgme_op_card_edit(gpgme_ctx_t ctx, gpgme_key_t key,
+ gpgme_edit_cb_t fnc, void *fnc_value,
+ gpgme_data_t out);
/* Key management functions. */
-struct _gpgme_op_keylist_result
-{
- unsigned int truncated : 1;
+struct _gpgme_op_keylist_result {
+ unsigned int truncated : 1;
- /* Internal to GPGME, do not use. */
- unsigned int _unused : 31;
+ /* Internal to GPGME, do not use. */
+ unsigned int _unused : 31;
};
typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t;
/* Retrieve a pointer to the result of the key listing operation. */
-gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx);
+gpgme_keylist_result_t gpgme_op_keylist_result(gpgme_ctx_t ctx);
/* Start a keylist operation within CTX, searching for keys which
match PATTERN. If SECRET_ONLY is true, only secret keys are
returned. */
-gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern,
- int secret_only);
-gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx,
- const char *pattern[],
- int secret_only, int reserved);
+gpgme_error_t gpgme_op_keylist_start(gpgme_ctx_t ctx, const char *pattern,
+ int secret_only);
+gpgme_error_t gpgme_op_keylist_ext_start(gpgme_ctx_t ctx,
+ const char *pattern[],
+ int secret_only, int reserved);
/* Return the next key from the keylist in R_KEY. */
-gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key);
+gpgme_error_t gpgme_op_keylist_next(gpgme_ctx_t ctx, gpgme_key_t *r_key);
/* Terminate a pending keylist operation within CTX. */
-gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx);
+gpgme_error_t gpgme_op_keylist_end(gpgme_ctx_t ctx);
/* Trust items and operations. */
-struct _gpgme_trust_item
-{
- /* Internal to GPGME, do not use. */
- unsigned int _refs;
+struct _gpgme_trust_item {
+ /* Internal to GPGME, do not use. */
+ unsigned int _refs;
+
+ /* The key ID to which the trust item belongs. */
+ char *keyid;
- /* The key ID to which the trust item belongs. */
- char *keyid;
+ /* Internal to GPGME, do not use. */
+ char _keyid[16 + 1];
- /* Internal to GPGME, do not use. */
- char _keyid[16 + 1];
+ /* The type of the trust item, 1 refers to a key, 2 to a user ID. */
+ int type;
- /* The type of the trust item, 1 refers to a key, 2 to a user ID. */
- int type;
+ /* The trust level. */
+ int level;
- /* The trust level. */
- int level;
+ /* The owner trust if TYPE is 1. */
+ char *owner_trust;
- /* The owner trust if TYPE is 1. */
- char *owner_trust;
+ /* Internal to GPGME, do not use. */
+ char _owner_trust[2];
- /* Internal to GPGME, do not use. */
- char _owner_trust[2];
+ /* The calculated validity. */
+ char *validity;
- /* The calculated validity. */
- char *validity;
-
- /* Internal to GPGME, do not use. */
- char _validity[2];
+ /* Internal to GPGME, do not use. */
+ char _validity[2];
- /* The user name if TYPE is 2. */
- char *name;
+ /* The user name if TYPE is 2. */
+ char *name;
};
typedef struct _gpgme_trust_item *gpgme_trust_item_t;
/* Start a trustlist operation within CTX, searching for trust items
which match PATTERN. */
-gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx,
- const char *pattern, int max_level);
+gpgme_error_t gpgme_op_trustlist_start(gpgme_ctx_t ctx,
+ const char *pattern, int max_level);
/* Return the next trust item from the trustlist in R_ITEM. */
-gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx,
- gpgme_trust_item_t *r_item);
+gpgme_error_t gpgme_op_trustlist_next(gpgme_ctx_t ctx,
+ gpgme_trust_item_t *r_item);
/* Terminate a pending trustlist operation within CTX. */
-gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx);
+gpgme_error_t gpgme_op_trustlist_end(gpgme_ctx_t ctx);
/* Acquire a reference to ITEM. */
-void gpgme_trust_item_ref (gpgme_trust_item_t item);
+void gpgme_trust_item_ref(gpgme_trust_item_t item);
/* Release a reference to ITEM. If this was the last one the trust
item is destroyed. */
-void gpgme_trust_item_unref (gpgme_trust_item_t item);
+void gpgme_trust_item_unref(gpgme_trust_item_t item);
/* Release the trust item ITEM. Deprecated, use
gpgme_trust_item_unref. */
-void gpgme_trust_item_release (gpgme_trust_item_t item) _GPGME_DEPRECATED;
+void gpgme_trust_item_release(gpgme_trust_item_t item) _GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of ITEM, which has to be
representable by a string. Deprecated, use trust item structure
directly. */
-const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item,
- _gpgme_attr_t what,
- const void *reserved, int idx)
- _GPGME_DEPRECATED;
+const char *gpgme_trust_item_get_string_attr(gpgme_trust_item_t item,
+ _gpgme_attr_t what,
+ const void *reserved, int idx)
+_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of KEY, which has to be
representable by an integer. IDX specifies a running index if the
attribute appears more than once in the key. Deprecated, use trust
item structure directly. */
-int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what,
- const void *reserved, int idx)
- _GPGME_DEPRECATED;
+int gpgme_trust_item_get_int_attr(gpgme_trust_item_t item, _gpgme_attr_t what,
+ const void *reserved, int idx)
+_GPGME_DEPRECATED;
/* Various functions. */
/* Check that the library fulfills the version requirement. */
-const char *gpgme_check_version (const char *req_version);
+const char *gpgme_check_version(const char *req_version);
/* Get the information about the configured and installed engines. A
pointer to the first engine in the statically allocated linked list
is returned in *INFO. If an error occurs, it is returned. The
returned data is valid until the next gpgme_set_engine_info. */
-gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info);
+gpgme_error_t gpgme_get_engine_info(gpgme_engine_info_t *engine_info);
/* Set the default engine info for the protocol PROTO to the file name
FILE_NAME and the home directory HOME_DIR. */
-gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto,
- const char *file_name,
- const char *home_dir);
+gpgme_error_t gpgme_set_engine_info(gpgme_protocol_t proto,
+ const char *file_name,
+ const char *home_dir);
/* Engine support functions. */
/* Verify that the engine implementing PROTO is installed and
available. */
-gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto);
+gpgme_error_t gpgme_engine_check_version(gpgme_protocol_t proto);
/* Deprecated types. */
@@ -1692,12 +1659,12 @@ typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED;
#define GpgmeDataCbs gpgme_data_cbs
typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED;
typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED;
-typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED;
+typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED;
typedef gpgme_verify_result_t GpgmeVerifyResult _GPGME_DEPRECATED;
typedef gpgme_import_status_t GpgmeImportStatus _GPGME_DEPRECATED;
typedef gpgme_import_result_t GpgmeImportResult _GPGME_DEPRECATED;
typedef gpgme_genkey_result_t GpgmeGenKeyResult _GPGME_DEPRECATED;
-typedef gpgme_trust_item_t GpgmeTrustItem _GPGME_DEPRECATED;
+typedef gpgme_trust_item_t GpgmeTrustItem _GPGME_DEPRECATED;
typedef gpgme_status_code_t GpgmeStatusCode _GPGME_DEPRECATED;
#ifdef __cplusplus