<div dir="ltr"><p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">Hi all.</p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"> </p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">I’m having
this problem with code that would like to decrypt a large gpg file (252 MB)
which is password protected!</span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">I set the
environment which works whit smaller files but in this case I face</span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:"Courier New"">117473366 --> Cannot allocate memory</span><span lang="EN-US"></span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">Is there
any option that I can set to use something similar auto-expand-secmem? Is there
any other way to solve the problem?</span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">Thank you
very much for your attention!</span></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)"> </span></b></p><p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)">Code sample below:</span></b></p><p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)">-------------------------------------------</span></b></p><p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)"><br></span></b></p><p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">bool res(false);<br><br>  gpgme_ctx_t ctx;<br>  gpgme_error_t err(GPG_ERR_NO_ERROR);<br>  gpgme_data_t in;<br>  gpgme_data_t out;<br>  gpgme_engine_info_t engineInfo;<br><br>  size_t inFileSize(fs::file_size(input));<br>  std::ostringstream oss;<br>  oss << std::dec << inFileSize;<br>  std::string fileSizeStr(oss.str());<br><br>  VCIUpdaterWrapper wrap;<br>  wrap.setObj(const_cast<VCIUpdater*>(this));<br>  wrap.setFileSize(fs::file_size(input));<br><br>  memset(&ctx, 0, sizeof(ctx));<br>  memset(&in, 0, sizeof(in));<br>  memset(&out, 0, sizeof(out));<br>  memset(&engineInfo, 0, sizeof(engineInfo));<br><br>  setlocale(LC_ALL, "");<br>  gpgme_check_version(NULL);<br><br>  gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));<br><br>  err = gpgme_new(&ctx);<br>  if (err) {<br>    GENERIC_LOG_MESSAGE(LogLevel::error,<br>                        (boost::format("Failed to create GPG context with error: %1% --> %2%") % err % gpgme_strerror(err)).str())<br>    return res;<br>  }<br><br>  engineInfo = gpgme_ctx_get_engine_info(ctx);<br>  err = gpgme_ctx_set_engine_info(ctx, engineInfo->protocol, engineInfo->file_name,<br>                                  VCIUpdateConfigurations::getInstance().getVciUpdateBaseFolder().c_str());<br>  if (err) {<br>    GENERIC_LOG_MESSAGE(LogLevel::error,<br>                        (boost::format("Failed to set engine info with error: %1% --> %2%") % err % gpgme_strerror(err)).str())<br>    return res;<br>  }<br><br>  gpgme_set_armor(ctx, 0);<br>  gpgme_set_pinentry_mode(ctx, GPGME_PINENTRY_MODE_LOOPBACK);<br>  gpgme_set_passphrase_cb(ctx, &passwfFuncCb, NULL);<br><br>  err = gpgme_data_new_from_file(&in, input.string().c_str(), 1);<br>  if (err) {<br>    GENERIC_LOG_MESSAGE(<br>        LogLevel::error,<br>        (boost::format("Failed to set input file %1% for GPG with error: %2% --> %3%") % input.string() % err % gpgme_strerror(err)).str())<br>    return res;<br>  }<br>//  else {<br>//    err = gpgme_data_set_flag(in, "size-hint", fileSizeStr.c_str());<br>//<br>//    if (err) {<br>//      GENERIC_LOG_MESSAGE(<br>//          LogLevel::error,<br>//          (boost::format("Failed to set size hint for input file %1% for GPG with error: %2% --> %3%") % input.string() % err<br>//              % gpgme_strerror(err)).str())<br>//      return res;<br>//    }<br>//  }<br><br>  FILE *outFile(::fopen(output.string().c_str(), "w+"));<br><br>  if (outFile) {<br>    err = gpgme_data_new_from_stream(&out, outFile);<br>    if (err) {<br>      GENERIC_LOG_MESSAGE(<br>          LogLevel::error,<br>          (boost::format("Failed to set output file %1% for GPG with error: %2% --> %3%") % output.string() % err % gpgme_strerror(err)).str())<br>      return res;<br>    }<br>//    else {<br>//      err = gpgme_data_set_flag(out, "size-hint", fileSizeStr.c_str());<br>//<br>//      if (err) {<br>//        GENERIC_LOG_MESSAGE(<br>//            LogLevel::error,<br>//            (boost::format("Failed to set size hint for output file %1% for GPG with error: %2% --> %3%") % output.string() % err<br>//                % gpgme_strerror(err)).str())<br>//        return res;<br>//      }<br>//    }<br>  } else {<br>    GENERIC_LOG_MESSAGE(LogLevel::error, "Failed to open out file " + output.string());<br>    return res;<br>  }<br><br>  gpgme_set_progress_cb(ctx, &VCIUpdaterWrapper::progress, NULL);<br><br>  gpgme_decrypt_result_t dec_result;<br>  err = gpgme_op_decrypt_start(ctx, in, out);<br>  if (err) {<br>    GENERIC_LOG_MESSAGE(LogLevel::error,<br>                        (boost::format("Failed to execute GPG decryption: %1% --> %2%") % err % gpgme_strerror(err)).str())<br><br>    dec_result = gpgme_op_decrypt_result(ctx);<br><br>    return res;<br>  } else {<br>    gpgme_wait(ctx, &err, 1);<br><br>    if (err) {<br>      GENERIC_LOG_MESSAGE(LogLevel::error,<br>                          (boost::format("Failed to execute GPG decryption: %1% --> %2%") % err % gpgme_strerror(err)).str())<br><br>      dec_result = gpgme_op_decrypt_result(ctx);<br><br>      return res;<br>    }<br><br>    dec_result = gpgme_op_decrypt_result(ctx);<br>    if (dec_result->unsupported_algorithm) {<br>      GENERIC_LOG_MESSAGE(LogLevel::error, dec_result->unsupported_algorithm);<br>      return res;<br>    }<br>  }<br><br>  gpgme_data_release(in);<br>  gpgme_data_release(out);<br><br>  ::fclose(outFile);<br><br>  gpgme_release(ctx);<br><br>  mSignalUpdateProgress(mWholeUpdatePackages, mDoneUpdates + 1, 100, UpdatePhase::gpg_decripth);<br><br>  res = true;<br>  return res;<b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)"><br></span></b></p><p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)"><br></span></b></p><p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)">---------------------------------------</span></b></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)"> </span></b></p>

<p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:10pt;color:rgb(89,89,89)">Marco Bna’</span></b><span lang="EN-US"></span></p></div>