tests/auto/qsslsocket/tst_qsslsocket.cpp
changeset 30 5dc02b23752f
parent 22 79de32ba3296
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   664 {
   664 {
   665 }
   665 }
   666 
   666 
   667 void tst_QSslSocket::localCertificate()
   667 void tst_QSslSocket::localCertificate()
   668 {
   668 {
       
   669     if (!QSslSocket::supportsSsl())
       
   670         return;
       
   671 
       
   672     // This test does not make 100% sense yet. We just set some local CA/cert/key and use it
       
   673     // to authenticate ourselves against the server. The server does not actually check this
       
   674     // values. This test should just run the codepath inside qsslsocket_openssl.cpp
       
   675 
       
   676     QSslSocketPtr socket = newSocket();
       
   677     QList<QSslCertificate> localCert = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem");
       
   678     socket->setCaCertificates(localCert);
       
   679     socket->setLocalCertificate(QLatin1String(SRCDIR "certs/fluke.cert"));
       
   680     socket->setPrivateKey(QLatin1String(SRCDIR "certs/fluke.key"));
       
   681 
       
   682     socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
       
   683     QVERIFY(socket->waitForEncrypted(5000));
   669 }
   684 }
   670 
   685 
   671 void tst_QSslSocket::mode()
   686 void tst_QSslSocket::mode()
   672 {
   687 {
   673 }
   688 }