aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/FileEncryptionDialog.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-06-08 20:20:59 +0000
committerSaturneric <[email protected]>2021-06-08 20:20:59 +0000
commitdf0846fcc22b886f80bacec5b123967f57b4e6a1 (patch)
treea694d0a802e95094e4bab081490595d48ec3277c /src/ui/FileEncryptionDialog.cpp
parentAdd Some file. (diff)
downloadGpgFrontend-df0846fcc22b886f80bacec5b123967f57b4e6a1.tar.gz
GpgFrontend-df0846fcc22b886f80bacec5b123967f57b4e6a1.zip
Check whether the key can be encrypted before the encryption operation.
Establish and improve the results analysis framework. Analyze and output the encryption result. Analyze the decryption results and output. Analyze and output the signature result. Analyze and output the encrypted and signed results. Adjust part of GpgContext API interface. Improve the interface for finding keys based on ID. Signed-off-by: Saturneric <[email protected]>
Diffstat (limited to 'src/ui/FileEncryptionDialog.cpp')
-rwxr-xr-xsrc/ui/FileEncryptionDialog.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/FileEncryptionDialog.cpp b/src/ui/FileEncryptionDialog.cpp
index 813b9278..9cb7b00a 100755
--- a/src/ui/FileEncryptionDialog.cpp
+++ b/src/ui/FileEncryptionDialog.cpp
@@ -199,19 +199,20 @@ void FileEncryptionDialog::slotExecuteAction() {
QByteArray inBuffer = infile.readAll();
auto *outBuffer = new QByteArray();
infile.close();
+
+ QVector<GpgKey> keys;
+ mKeyList->getCheckedKeys(keys);
+
if (mAction == Encrypt) {
- if (!mCtx->encrypt(mKeyList->getChecked(), inBuffer, outBuffer)) return;
+ if (!mCtx->encrypt(keys, inBuffer, outBuffer, nullptr)) return;
}
if (mAction == Decrypt) {
- if (!mCtx->decrypt(inBuffer, outBuffer)) return;
+ if (!mCtx->decrypt(inBuffer, outBuffer, nullptr)) return;
}
if (mAction == Sign) {
- QVector<GpgKey> keys;
- mKeyList->getCheckedKeys(keys);
- if (!mCtx->sign(keys, inBuffer, outBuffer, true)) return;
-
+ if (gpgme_err_code(mCtx->sign(keys, inBuffer, outBuffer, true)) != GPG_ERR_NO_ERROR) return;
}
if (mAction == Verify) {
@@ -223,8 +224,9 @@ void FileEncryptionDialog::slotExecuteAction() {
return;
}
auto signBuffer = signfile.readAll();
- gpgme_signature_t sign = mCtx->verify(&inBuffer, &signBuffer);
- new VerifyDetailsDialog(this, mCtx, mKeyList, sign);
+ gpgme_verify_result_t result;
+ auto error = mCtx->verify(&inBuffer, &signBuffer, &result);
+ new VerifyDetailsDialog(this, mCtx, mKeyList, error, result);
return;
}