<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[execute enc command from QtProgram]]></title><description><![CDATA[<p dir="auto">Hi guys, I have the following question, I want to encrypt a file with openssl, but it doesn't give me any result, I get the message that it was encrypted, but in the Qt output panel, I get an invalid command.<br />
Any suggestion of how I could do it would be appreciated, I am using QProcess and Openssl 1.1 for it, below I leave the code, thanks in advance.</p>
<p dir="auto">code:</p>
<pre><code>#include "mainwindow.h"
#include "./ui_mainwindow.h"

#include &lt;QProcess&gt;
#include &lt;QMessageBox&gt;

MainWindow::MainWindow(QWidget *parent)
  : QMainWindow(parent), ui(new Ui::MainWindow)
{
  ui-&gt;setupUi(this);


}

MainWindow::~MainWindow()
{
  delete ui;
}


void MainWindow::on_pushButton_clicked()
{
  QProcess *proc=new QProcess(this);
  QStringList argv;
  argv.append(" enc -des-cbc -a -in C:/Users/Lincoln/Desktop/test.txt -pass pass:123");
  argv.append(" -out C:/Users/Lincoln/Desktop/test.enc");
  bool res=proc-&gt;startDetached("D:/OpenSSL-Win64/bin/openssl.exe",argv);
  if(res)
    QMessageBox::information(this,qApp-&gt;applicationName(),"Archivo encriptado");
  else
    QMessageBox::critical(this,qApp-&gt;applicationName(),"Hubo un error");
}

</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/2c003926-1fa3-4cae-ad19-f871233f0cd2.png" alt="c76f3633-d429-47e3-84e1-57781399001a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Note that I get an encrypted file, but below it says something else.</p>
]]></description><link>https://forum.qt.io/topic/122264/execute-enc-command-from-qtprogram</link><generator>RSS for Node</generator><lastBuildDate>Sat, 04 Apr 2026 00:50:43 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/122264.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 Jan 2021 23:47:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to execute enc command from QtProgram on Sat, 02 Jan 2021 00:30:24 GMT]]></title><description><![CDATA[<p dir="auto">great, i fixed it, thanks man.</p>
]]></description><link>https://forum.qt.io/post/635309</link><guid isPermaLink="true">https://forum.qt.io/post/635309</guid><dc:creator><![CDATA[lincoln]]></dc:creator><pubDate>Sat, 02 Jan 2021 00:30:24 GMT</pubDate></item><item><title><![CDATA[Reply to execute enc command from QtProgram on Sat, 02 Jan 2021 00:12:29 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
You construct the argv incorrectly so its tries to run enc as an app and that fails.<br />
Each parameter should be added on its own like.</p>
<p dir="auto">QStringList arguments;<br />
arguments &lt;&lt; "enc" &lt;&lt; "-des-cbc"  &lt;&lt; "-a" and so on;</p>
<p dir="auto"><a href="https://doc.qt.io/qt-5/qprocess.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qprocess.html</a></p>
]]></description><link>https://forum.qt.io/post/635307</link><guid isPermaLink="true">https://forum.qt.io/post/635307</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sat, 02 Jan 2021 00:12:29 GMT</pubDate></item></channel></rss>