From 28ee39f0b991d28d5357cf4a7949e8a42bbf3f08 Mon Sep 17 00:00:00 2001 From: nils Date: Fri, 3 Jan 2014 18:41:12 +0000 Subject: BUGFIX: export of private key in non-ascii path fixed git-svn-id: http://cpunk.de/svn/src/gpg4usb/branches/0.3.2-1@1076 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgcontext.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'gpgcontext.cpp') diff --git a/gpgcontext.cpp b/gpgcontext.cpp index 2eef101..d459f37 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -67,11 +67,11 @@ GpgContext::GpgContext() * also lin/win must be checked, for calling gpg.exe if needed */ #ifdef _WIN32 - QString gpgBin = appPath + "/bin/gpg.exe"; + gpgBin = appPath + "/bin/gpg.exe"; #else - QString gpgBin = appPath + "/bin/gpg"; + gpgBin = appPath + "/bin/gpg"; #endif - QString gpgKeys = appPath + "/keydb"; + gpgKeys = appPath + "/keydb"; /* err = gpgme_ctx_set_engine_info(mCtx, GPGME_PROTOCOL_OpenPGP, gpgBin.toUtf8().constData(), gpgKeys.toUtf8().constData());*/ @@ -559,6 +559,7 @@ QString GpgContext::gpgErrString(gpgme_error_t err) { void GpgContext::exportSecretKey(QString uid, QByteArray *outBuffer) { + qDebug() << *outBuffer; // export private key to outBuffer QStringList arguments; arguments << "--armor" << "--export-secret-key" << uid; @@ -576,17 +577,19 @@ void GpgContext::exportSecretKey(QString uid, QByteArray *outBuffer) /** return type should be gpgme_error_t*/ void GpgContext::executeGpgCommand(QStringList arguments, QByteArray *stdOut, QByteArray *stdErr) { - gpgme_engine_info_t engine = gpgme_ctx_get_engine_info(mCtx); - QStringList args; - args << "--homedir" << engine->home_dir << "--batch" << arguments; + args << "--homedir" << gpgKeys << "--batch" << arguments; + qDebug() << args; QProcess gpg; - gpg.start(engine->file_name, args); + // qDebug() << "engine->file_name" << engine->file_name; + + gpg.start(gpgBin, args); gpg.waitForFinished(); *stdOut = gpg.readAllStandardOutput(); *stdErr = gpg.readAllStandardError(); + qDebug() << *stdOut; } /*** -- cgit v1.2.3