[Qt-interest] QSslSocket serverside
Imre Péntek
pentek.imre at gmail.com
Sun Nov 1 00:33:28 CET 2009
Hello,
I have a code like this:
void mySslServerSocket::incomingConnection(int sockFd)
{
QSslSocket *serverSocket = new QSslSocket(this);
if (serverSocket->setSocketDescriptor(sockFd)) {
serverSocket->setLocalCertificate("/tmp/server.crt");
Q_ASSERT(!serverSocket->localCertificate().isNull());
serverSocket->setPrivateKey("/tmp/server.key");
Q_ASSERT(!serverSocket->privateKey().isNull());
connect(serverSocket, SIGNAL(encrypted()), this, SLOT(ready()));
serverSocket->startServerEncryption();
} else {
delete serverSocket;
qDebug()<<__FILE__<<':'<<__LINE__;
}
}
but it doesn't work. The key were generated using this script:
#!/bin/bash
length=${1:-1024}
openssl genrsa -des3 -out server.key $length
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
openssl x509 -noout -fingerprint -text < server.crt >server.info
chmod 400 *
and it works with openssl s_server, but when I run the above code, and try to
connect with openssl s_client it says:
CONNECTED(00000003)
3586:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake
failure:s23_lib.c:188:
What's wrong with the above code? Thank you for your suggestions in advance.
--
With Regards: Imre Péntek
E-Mail: pentek.imre at gmail.com
More information about the Qt-interest-old
mailing list