diff options
Diffstat (limited to 'src/gpg/function')
-rw-r--r-- | src/gpg/function/GpgKeyOpera.cpp | 36 | ||||
-rw-r--r-- | src/gpg/function/GpgKeyOpera.h | 4 |
2 files changed, 31 insertions, 9 deletions
diff --git a/src/gpg/function/GpgKeyOpera.cpp b/src/gpg/function/GpgKeyOpera.cpp index 2406cbb9..a7371904 100644 --- a/src/gpg/function/GpgKeyOpera.cpp +++ b/src/gpg/function/GpgKeyOpera.cpp @@ -93,21 +93,43 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::SetExpire( */ void GpgFrontend::GpgKeyOpera::GenerateRevokeCert( const GpgKey& key, const std::string& output_file_name) { - auto args = std::vector<std::string>{"--command-fd", "0", - "--status-fd", "1", - "-o", output_file_name.c_str(), - "--gen-revoke", key.fpr().c_str()}; + auto args = std::vector<std::string>{ + "--no-tty", "--command-fd", "0", "--status-fd", "1", "-o", + output_file_name, "--gen-revoke", key.fpr()}; + using boost::asio::async_write; using boost::process::async_pipe; GpgCommandExecutor::GetInstance().Execute( args, [](async_pipe& in, async_pipe& out) -> void { boost::asio::streambuf buff; boost::asio::read_until(in, buff, '\n'); - std::string line; std::istream is(&buff); - is >> line; - // Code From Gpg4Win + + while (!is.eof()) { + std::string line; + is >> line; + LOG(INFO) << "line" << line; + boost::algorithm::trim(line); + if (line == std::string("[GNUPG:] GET_BOOL gen_revoke.okay")) { + + } else if (line == + std::string( + "[GNUPG:] GET_LINE ask_revocation_reason.code")) { + + } else if (line == + std::string( + "[GNUPG:] GET_LINE ask_revocation_reason.text")) { + + } else if (line == + std::string("[GNUPG:] GET_BOOL openfile.overwrite.okay")) { + + } else if (line == + std::string( + "[GNUPG:] GET_BOOL ask_revocation_reason.okay")) { + + } + } }); } diff --git a/src/gpg/function/GpgKeyOpera.h b/src/gpg/function/GpgKeyOpera.h index d9573bd7..71e2de8b 100644 --- a/src/gpg/function/GpgKeyOpera.h +++ b/src/gpg/function/GpgKeyOpera.h @@ -38,8 +38,8 @@ class GpgKeyOpera : public SingletonFunctionObject<GpgKeyOpera> { GpgError SetExpire(const GpgKey& key, const SubkeyId& subkey_fpr, std::unique_ptr<boost::gregorian::date>& expires); - void GenerateRevokeCert(const GpgKey& key, - const std::string& output_file_name); + static void GenerateRevokeCert(const GpgKey& key, + const std::string& output_file_name); GpgFrontend::GpgError GenerateKey(const std::unique_ptr<GenKeyInfo>& params); |