<?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[&quot;SSL Certificate has no content&quot; error]]></title><description><![CDATA[<p dir="auto">Hello everyone, I am trying to connect  to a server url to get token from the server by posting the request with the parameters ,ssl certificates etc.But when I try to run the program I get "The certificate has no content"error .But the certificate has all the data inside it.  I  am attaching the code here. I don't understand how to resolve the error. Any help would be appreciated.</p>
<p dir="auto">QNetworkAccessManager  *networkManager = new QNetworkAccessManager(this);</p>
<pre><code>QByteArray postData;
QSslConfiguration config;
QString pemfile("path/to/cl_signed.pem");
QFile file(pemfile);
if(!file.exists()) {
    qWarning("Filename doent exists");
}
if(!file.open(QIODevice::ReadOnly)) {
    qWarning("Cannot open filename %s.", qPrintable(pemfile));
}  
QByteArray data_cert =file.readAll() ;
QSslCertificate sslcert(data_cert, QSsl::Pem);
config.setLocalCertificate(sslcert);
if(sslcert.isNull()) {
    qWarning("The certificate has no content.");
}
QByteArray keyData;
const QSslKey sslPrivateKey (keyData, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, "privatekey");
config.setPrivateKey(sslPrivateKey);
QUrl url("http:...................../oauth2/v1/token?");
QNetworkRequest request(url);
postData.append("param1");
postData.append("param2");
postData.append("param3");
postData.append(param4");
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
networkManager-&gt;post(request,postData);
QNetworkAccessManager mgr;
QObject::connect(&amp;mgr, SIGNAL(finished(QNetworkReply*)), SLOT(quit()));
QNetworkReply *reply = mgr.get(request);
if (reply-&gt;error() == QNetworkReply::NoError) 
 {
    QString strReply = (QString)reply-&gt;readAll();
    qDebug() &lt;&lt; "Response:" &lt;&lt; strReply;
    QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
    QJsonObject jsonObj = jsonResponse.object();
    qDebug() &lt;&lt; "result:" &lt;&lt; jsonObj["result"].toInt();
    delete reply;
 }
else
 {
    qDebug() &lt;&lt; "Failure" 
    delete reply;
 }
</code></pre>
]]></description><link>https://forum.qt.io/topic/135061/ssl-certificate-has-no-content-error</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 21:36:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/135061.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 Mar 2022 12:35:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &quot;SSL Certificate has no content&quot; error on Thu, 17 Mar 2022 09:26:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisw67">@<bdi>ChrisW67</bdi></a> The certificate is not empty. I tried printing some data from the certificate  and yes,it printed  that. There are two different pem files, since I have 2 client certificates and one private key .</p>
]]></description><link>https://forum.qt.io/post/706730</link><guid isPermaLink="true">https://forum.qt.io/post/706730</guid><dc:creator><![CDATA[Sini]]></dc:creator><pubDate>Thu, 17 Mar 2022 09:26:18 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;SSL Certificate has no content&quot; error on Thu, 17 Mar 2022 09:10:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/piervalli">@<bdi>piervalli</bdi></a> Yes I copied the necessay dll files  and pasted it in the bin folder, also i mentioned the path to all those dll in the .pro file.</p>
]]></description><link>https://forum.qt.io/post/706722</link><guid isPermaLink="true">https://forum.qt.io/post/706722</guid><dc:creator><![CDATA[Sini]]></dc:creator><pubDate>Thu, 17 Mar 2022 09:10:17 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;SSL Certificate has no content&quot; error on Wed, 16 Mar 2022 16:08:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sini">@<bdi>Sini</bdi></a>, Have you copied the dll for openssl?</p>
]]></description><link>https://forum.qt.io/post/706635</link><guid isPermaLink="true">https://forum.qt.io/post/706635</guid><dc:creator><![CDATA[piervalli]]></dc:creator><pubDate>Wed, 16 Mar 2022 16:08:40 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;SSL Certificate has no content&quot; error on Wed, 16 Mar 2022 08:14:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> .. Yes, I tried printing the certificate and its showing the data also.<br />
I am using Qt 5.15.0 and in Windows .</p>
]]></description><link>https://forum.qt.io/post/706558</link><guid isPermaLink="true">https://forum.qt.io/post/706558</guid><dc:creator><![CDATA[Sini]]></dc:creator><pubDate>Wed, 16 Mar 2022 08:14:32 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;SSL Certificate has no content&quot; error on Tue, 15 Mar 2022 23:48:48 GMT]]></title><description><![CDATA[<pre><code>QString pemfile("path/to/cl_signed.pem");
</code></pre>
<p dir="auto">will open a file at a path relative to the current working directory of the process.  The current working directory is not necessarily the same as the source path, build path, where the executable is, or even static within a run.  You may be opening an empty/corrupt PEM file other than the one you think you are opening.</p>
<p dir="auto">Is data_cert.size()  greater than  0?<br />
Is there more than one cl_signed.pem in the system?</p>
]]></description><link>https://forum.qt.io/post/706525</link><guid isPermaLink="true">https://forum.qt.io/post/706525</guid><dc:creator><![CDATA[ChrisW67]]></dc:creator><pubDate>Tue, 15 Mar 2022 23:48:48 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;SSL Certificate has no content&quot; error on Tue, 15 Mar 2022 20:22:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Did you try to print some data from sslcert ?<br />
Also, check the value of <a href="https://doc.qt.io/qt-5/qsslcertificate.html#isNull" target="_blank" rel="noopener noreferrer nofollow ugc">isNull</a>.</p>
<p dir="auto">By the way, which version of Qt are you using ?<br />
On which platform ?</p>
]]></description><link>https://forum.qt.io/post/706512</link><guid isPermaLink="true">https://forum.qt.io/post/706512</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 15 Mar 2022 20:22:17 GMT</pubDate></item></channel></rss>