Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, August 2007
ssl problems starting an encrypted connection


Message 1 in thread

Hi, I'm trying to build a client/server application with ssl encrypted
communication. There is no problem connecting in an unencrypted manner but
the encryption handshake seem to fail. When I call startServerEncryption()
from the server nothing happens, no encrypted signal is being emited and
when I try to send a message to the server the server disconnects.

The ssl code on server side looks like this:

connect(clientSocket, SIGNAL(encrypted()), this, SLOT(testSlot()));
clientSocket->setPrivateKey( QDir::currentPath() + "/server.key",
QSsl::Rsa );
clientSocket->setLocalCertificate( QDir::currentPath() + "/server.csr" );
clientSocket->startServerEncryption();
std::cout << clientSocket->errorString().toStdString() << std::endl;

The key and certification files was genereated with the command:
openssl req -x509 -newkey rsa:1024 -keyout server.key -days 365 -out
server.crt


The ssl code on client side looks like this:

mClient->setPrivateKey( QDir::currentPath() + "../Server/server.key",
QSsl::Rsa );
mClient->setLocalCertificate( QDir::currentPath() + "../Server/server.crt" );
mClient->startClientEncryption();


where the server.key and server.crt files are the same as in server.
The error I get from the cout command on server only says "unknown error".

I'm not sure where to find information on how to build a working ssl
application in qt 4.3. Does anybody have an example to show me so I could
exclude the possibility of a bad installation of openSSL.


--
 [ signature omitted ]