[GPGME] Repeated decrypt fails
trinh.randy at gmail.com
Thu May 17 20:48:01 CEST 2018
On Thu, May 17, 2018 at 11:35 AM, Ben McGinnes <ben at adversary.org> wrote:
> > Does the website encrypt the file uploaded by (eventually) some end
> > user or do they encrypt the file first and then upload that which your
> > code subsequently decrypts?
The file is encrypted first by the user and then uploaded to which my code
subsequently decrypts it.
> Yeah, this is strange, but we'll need more info to work out what's
> > going on. Are you able to share the code for what's happening here
> > and, if the website also encrypts the uploaded data, that bit too?
Certainly! I've provided the entire GPGME portion of the function below,
I'm not entirely certain if this is acceptable to call every time my
program decides to attempt a decrypt though (Feel free to highlight my
setlocale (LC_ALL, "");
gpgme_error_t err, stat;
gpgme_data_t fileEncrypted, fileDecrypted, keydata;
std::string tempFile = "TemporaryFile";
std::string newFileName = "Decrypted";
std::string newFileNameExt = newFileName + ".tar.gz";
const char* name = newFileNameExt.c_str();
err = gpgme_new(&ctx);
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP);
int fdEncrypt = open(fileName, O_RDONLY);
int fdDecrypt = open(name, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
err = gpgme_data_new_from_fd(&fileEncrypted, fdEncrypt);
err = gpgme_data_new_from_fd(&fileDecrypted, fdDecrypt);
err = gpgme_op_decrypt_start(ctx, fileEncrypted, fileDecrypted);
ctx = gpgme_wait(ctx, &stat, 1);
std::cout << "Decrypt Status: " << gpgme_strerror(err) << std::endl;
gpgme_decrypt_result_t dResult = gpgme_op_decrypt_result(ctx);
std::cout << "invalid decrypt" << std::endl;
> > No, that's not normal and I'm wondering how it happened, but there are
> > some functions which might do it and it may also depend on which
> > version(s) of GPG and GPGME you're using. Which are they, by the way?
The version of GPG I am using is 2.0.22 (or 1.4.16) I have both installed
but I'm actually not entirely confident which one is being used by GPGME.
As for GPGME, I am using Ver 1.11.1.
Thanks for the reply! 😉
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gnupg-users