PDA

View Full Version : QSslSocket - problem with connecting to the server



kremuwa
17th July 2010, 23:07
I've written such piece of code:

sock.connectToHostEncrypted(host,port);
if(!sock.waitForEncrypted(TIMEOUT))
{
report(sock.errorString());
return false;
}

And when this part of the program is executed, I'm receiving such debug messages;

QSslSocket: cannot call unresolved function SSLv3_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
QSslSocket: cannot call unresolved function ERR_error_string

What's wrong? Is the program missing any DDL files? Does it have something to do with OpenSSL?

franz
18th July 2010, 07:43
Very likely so.

kremuwa
18th July 2010, 11:09
What's very likely? I think that installing OpenSSL will solve the problem for me but what to do when I want to distribute the program? On Linux it wouldn't be a problem, because OpenSSL is very popular there, but it's an application designed for Windows - is there a way to add OpenSSL to the my program's installation package? What ideas do you have?

squidge
18th July 2010, 12:12
Either include the OpenSSL with your program or provide a link to it, depending on it's license requirements.

kremuwa
18th July 2010, 12:18
But it seems I can't stop these errors from appearing even on my computer - they're still present after installing OpenSSL for Win32 from this site: http://www.slproweb.com/products/Win32OpenSSL.html
Maybe I should copy some OpenSSL-realted DLLs to the executable's catalogue? I'm really confused - I don't understand it at all, and Qt's SSL documentation doesn't say much about OpenSSL, either.

squidge
18th July 2010, 12:39
Is OpenSSL in your path?

kremuwa
18th July 2010, 13:26
What do you mean saying "in your path"? What path? I've installed it in C:/OpenSSL while my project is In E:/.../

EDIT:
Ok, I've managed to make it work, but that's only on my device. Now I'm thinking which files should I include to the installation package to not have to run separate installation.

squidge
18th July 2010, 14:34
Windows+R -> cmd -> echo %PATH%

Is the OpenSSL libs in that path?

kremuwa
18th July 2010, 15:10
No, it isn't but it's working although this fact.

Now I'm thinking which files should I include to the installation package to not have to run separate installation.

lyhoanghai
26th August 2010, 14:40
This method works for me (Qt 4.6 in Nokia Qt SDK)
http://codeblog.vurdalakov.net/2009/11/solution-qsslsocket-cannot-call.html
You need to install OpenSSL Win32 or Win64 binaries.

1. Open Win32 OpenSSL Installation Project page.
2. Download the latest "light" Win32 or Win64 installation package, for example "Win32 OpenSSL v0.9.8l Light".
3. Install it to any location. Ignore "Microsoft Visual C++ 2008 Redistributables" warning (click OK) and select copying OpenSSL DLLs to "The OpenSSL binaries (\bin) directory".
4. Copy libeay32.dll and ssleay32.dll from the \bin folder to the same place where your QtNetwork4.dll or QtNetworkd4.dll is located.

(In Nokia Qt SDK - there are 2 folders which are missing those file)