diff options
author | Saturneric <[email protected]> | 2021-08-19 04:28:57 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-08-19 04:28:57 +0000 |
commit | d9822971050c5b796a1a5a7b4a45bfd9a00e0d88 (patch) | |
tree | b8759e6ea881a370e8fea667b5adf8facf9d4082 /src/gpg/gpg_context/GpgContextKeyOpera.cpp | |
parent | Bugs Fixed; Improve Functions; (diff) | |
download | GpgFrontend-d9822971050c5b796a1a5a7b4a45bfd9a00e0d88.tar.gz GpgFrontend-d9822971050c5b796a1a5a7b4a45bfd9a00e0d88.zip |
Bugs Fixed; Improve Functions;
Diffstat (limited to 'src/gpg/gpg_context/GpgContextKeyOpera.cpp')
-rw-r--r-- | src/gpg/gpg_context/GpgContextKeyOpera.cpp | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/src/gpg/gpg_context/GpgContextKeyOpera.cpp b/src/gpg/gpg_context/GpgContextKeyOpera.cpp index 54123405..5ead0629 100644 --- a/src/gpg/gpg_context/GpgContextKeyOpera.cpp +++ b/src/gpg/gpg_context/GpgContextKeyOpera.cpp @@ -364,48 +364,46 @@ bool GpgME::GpgContext::signKey(const GpgKey &target, const QString &uid, const } /** - * Generate revoke cert of a key pair (TODO) + * Generate revoke cert of a key pair * @param key target key pair * @param outputFileName out file name(path) * @return the process doing this job */ -QProcess *GpgME::GpgContext::generateRevokeCert(const GpgKey &key, const QString &outputFileName) { - QByteArray out, stdErr; - auto process = executeGpgCommand({ - "--command-fd", - "0", - "--status-fd", "1", - "-o", - outputFileName, - "--gen-revoke", - key.fpr - }, &out, &stdErr, - [](QProcess *proc) { - qDebug() << "Function Called" << proc; - while (proc->canReadLine()) { - const QString line = QString::fromUtf8(proc->readLine()).trimmed(); - // Command-fd is a stable interface, while this is all kind of hacky we - // are on a deadline :-/ - if (line == QLatin1String("[GNUPG:] GET_BOOL gen_revoke.okay")) { - proc->write("y\n"); - } else if (line == QLatin1String( - "[GNUPG:] GET_LINE ask_revocation_reason.code")) { - proc->write("0\n"); - } else if (line == QLatin1String( - "[GNUPG:] GET_LINE ask_revocation_reason.text")) { - proc->write("\n"); - } else if (line == QLatin1String( - "[GNUPG:] GET_BOOL openfile.overwrite.okay")) { - // We asked before - proc->write("y\n"); - } else if (line == QLatin1String( - "[GNUPG:] GET_BOOL ask_revocation_reason.okay")) { - proc->write("y\n"); - } - } - }); - - qDebug() << "GenerateRevokeCert Process" << process; - - return process; +void GpgME::GpgContext::generateRevokeCert(const GpgKey &key, const QString &outputFileName) { + executeGpgCommand({ + "--command-fd", + "0", + "--status-fd", + "1", + //"--no-tty", + "-o", + outputFileName, + "--gen-revoke", + key.fpr + }, + [](QProcess *proc) -> void { + qDebug() << "Function Called" << proc; + // Code From Gpg4Win + while (proc->canReadLine()) { + const QString line = QString::fromUtf8(proc->readLine()).trimmed(); + if (line == QLatin1String("[GNUPG:] GET_BOOL gen_revoke.okay")) { + proc->write("y\n"); + } else if (line == QLatin1String( + "[GNUPG:] GET_LINE ask_revocation_reason.code")) { + proc->write("0\n"); + } else if (line == QLatin1String( + "[GNUPG:] GET_LINE ask_revocation_reason.text")) { + proc->write("\n"); + } else if (line == QLatin1String( + "[GNUPG:] GET_BOOL openfile.overwrite.okay")) { + // We asked before + proc->write("y\n"); + } else if (line == QLatin1String( + "[GNUPG:] GET_BOOL ask_revocation_reason.okay")) { + proc->write("y\n"); + } + } + // Code From Gpg4Win + } + ); } |