Advertisement
Guest User

Untitled

a guest
Sep 4th, 2014
251
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4.     QTcpSocket *connection = server_devices.nextPendingConnection();
  5.     QSslSocket *ssl=new QSslSocket(this);
  6.     if(ssl->setSocketDescriptor(connection->socketDescriptor(),connection->state(),connection->openMode())) {
  7.  
  8.  
  9.         ssl->setLocalCertificate("/home/Desktop/Smart1SSL/server.crt");
  10.         ssl->setPrivateKey("/home/Desktop/Smart1SSL/server.key.insecure");
  11.  
  12.         ssl->startServerEncryption();
  13.         if(ssl->waitForEncrypted()) {
  14.               qDebug() << "Encryped!";
  15.               clientConnection = ssl;
  16.  
  17.         }
  18.         else {
  19.             this->deleteLater();
  20.             return;
  21.         }
  22.  
  23.     }
  24.     else {
  25.         this->deleteLater();
  26.         return;
  27.     }
  28.  
  29.  
  30.     qDebug() << ssl->sslErrors() << ssl->errorString() << ssl->error();
  31.  
  32.  
  33.     connect(clientConnection, SIGNAL(readyRead()), this, SLOT(readFromSocket()));
  34.     connect(clientConnection, SIGNAL(disconnected()), this, SLOT(deleteLater()));
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement