PDA

View Full Version : run-time vs linked OpenSSL support



piotr.dobrogost
16th July 2009, 12:26
What's the difference between run-time and linked OpenSSL support when building Qt?

jpn
16th July 2009, 14:01
Resolving OpenSSL libs dynamically at run-time when needed vs. linking to OpenSSL libs when building Qt. The former is much more dynamic - the latter requires that the necessary libs are present also when deployed or the app won't run.

piotr.dobrogost
16th July 2009, 20:48
Resolving OpenSSL libs dynamically at run-time when needed vs. linking to OpenSSL libs when building Qt. The former is much more dynamic - the latter requires that the necessary libs are present also when deployed or the app won't run.

I'm still confused. Are we talking about dynamic vs static linking?

jpn
16th July 2009, 20:54
No, we are talking about linking versus loading a shared library at runtime (ie. QLibrary).

piotr.dobrogost
16th July 2009, 21:05
No, we are talking about linking versus loading a shared library at runtime (ie. QLibrary).

Linking versus loading on Windows?
Either you link with a static library meaning you incorporate its code into your code or you link with a dynamic library and then load dll file at run-time...

Am I missing something?

jpn
16th July 2009, 21:24
I'm not referring to dynamic or static linking in particular, I'm just talking about linking in general.

It is possible to access a shared library without linking, via dlopen() on *nix and something else on Windows I suppose (QLibrary hides this). The idea is to load the shared library at runtime and resolve exported symbols on the fly. This way the program can be run with or without the shared library. Resolving will just fail if the library doesn't exist, and the particular feature can be left out. But if you link to a library, the library needs to exist in order to launch the application.

wysota
16th July 2009, 22:39
In other words linked approach requires you to ship OpenSSL libraries even if your application doesn't use SSL. Run-time dependency means OpenSSL is treated as a plugin and loaded when needed.

SABROG
17th July 2009, 06:30
I always thinking what -opensll-linked must incapsulate all OpenSLL code into QtNetwork4.dll and not have dependencies for libeay32.dll or something else. So if its wrong, we want third key for configure - -openssl-static for example.

wysota
17th July 2009, 07:56
So if its wrong, we want third key for configure - -openssl-static for example.

You don't need such a key, just build OpenSSL in static mode and make sure it comes before the dynamic one in library lookup path.

piotr.dobrogost
17th July 2009, 09:02
You don't need such a key, just build OpenSSL in static mode and make sure it comes before the dynamic one in library lookup path.

Which in case of Windows is just PATH as there's no such thing like special library lookup path on Windows, right?

wysota
17th July 2009, 09:13
Which in case of Windows is just PATH as there's no such thing like special library lookup path on Windows, right?

I meant the -L switch to gcc/MinGW.

Software
26th March 2012, 11:07
Hi All,

I am new in Qt programming, i need your help to resolve an issue.
I want to display certificate information of secured website in "Qt demo brower", for this i write code to display but i am unable to get "defaultCaCertificate", "caCertificate" and "peerCertificateChain".
Do we need any type of initilization before using these APIs ?

Every time when i call below code it retrive 0 items in dCaCertificates.
QList<QSslCertificate> dCaCertificates = QSslSocket::defaultCaCertificates();

But i am able to get system certificates using below code:
QList<QSslCertificate> sysCertificates = QSslSocket::systemCaCertificates();

Please help me, its urgent.

Regards,
Pranay

Software
30th March 2012, 06:56
Hi Pranay,

If you want to get and display certificate details in Qt demo browser, here is the code:
First of all to peerCertificateChain details, one can use the SLOT sslError, the argument within this SLOT named QNetworkReply have all the details of peerCertificateChain and peerCertificate.

void NetworkAccessManager::sslError(QNetworkReply *reply, const QList<QSslError> &error)
{
QList<QSslCertificate> peerCertificateChain = reply->sslConfiguration().peerCertificateChain();
}

Thanks & Regards,
Software