diff options
author | Saturneric <[email protected]> | 2021-07-05 16:33:22 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-07-05 16:33:22 +0000 |
commit | 4286627bc87dba16b739a205708f3c7029da27e5 (patch) | |
tree | 7c30ae2dcc8c58711ccd08543556cf989b1b89f6 /src/gpg/GpgFileOpera.cpp | |
parent | Fix the logic problem of the signature and encryption function. (diff) | |
download | GpgFrontend-4286627bc87dba16b739a205708f3c7029da27e5.tar.gz GpgFrontend-4286627bc87dba16b739a205708f3c7029da27e5.zip |
Introduce multithreading.
Fix Bugs.
Diffstat (limited to '')
-rw-r--r-- | src/gpg/GpgFileOpera.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/gpg/GpgFileOpera.cpp b/src/gpg/GpgFileOpera.cpp index f7db9d44..ee2f1e0d 100644 --- a/src/gpg/GpgFileOpera.cpp +++ b/src/gpg/GpgFileOpera.cpp @@ -142,24 +142,25 @@ gpgme_error_t GpgFileOpera::verifyFile(GpgME::GpgContext *ctx, const QString &mP if (!infile.open(QIODevice::ReadOnly)) throw std::runtime_error("cannot open file"); - QByteArray inBuffer = infile.readAll(); - QFile signFile; - signFile.setFileName(mPath + ".sig"); - if (!signFile.open(QIODevice::ReadOnly)) { - throw std::runtime_error("cannot open file"); + if(fileInfo.suffix() == "gpg") { + auto error = ctx->verify(&inBuffer, nullptr, result); + return error; } + else { + QFile signFile; + signFile.setFileName(mPath + ".sig"); + if (!signFile.open(QIODevice::ReadOnly)) { + throw std::runtime_error("cannot open file"); + } + auto signBuffer = signFile.readAll(); + infile.close(); - - auto signBuffer = signFile.readAll(); - infile.close(); - - - auto error = ctx->verify(&inBuffer, &signBuffer, result); - - return error; + auto error = ctx->verify(&inBuffer, &signBuffer, result); + return error; + } } gpg_error_t GpgFileOpera::encryptSignFile(GpgME::GpgContext *ctx, QVector<GpgKey> &keys, const QString &mPath, |