#include "polaczeniessl.h"
PolaczenieSSL
::PolaczenieSSL(QWidget *parent
){
}
PolaczenieSSL::~PolaczenieSSL()
{
}
void PolaczenieSSL::incomingConnection(int port)
{
qDebug()<<"incomingConnection";
QSslSocket *serverSocket = new QSslSocket;
connect(serverSocket, SIGNAL(encrypted()), this, SLOT(gotowy()));
connect(serverSocket,SIGNAL(sslErrors(QList<QSslError>)),this,SLOT(bledySSL(QList<QSslError>)));
connect(serverSocket,SIGNAL(sslErrors(QList<QSslError>)), serverSocket, SLOT(ignoreSslErrors()));
serverSocket->setProtocol(QSsl::AnyProtocol);
/*
QFile *file = new QFile("server.key");
QSslKey key(file, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, "server");
serverSocket->setPrivateKey(key);
serverSocket->setLocalCertificate("server.csr");
serverSocket->addCaCertificates("/etc/ssl/certs");
*/
if (serverSocket->setSocketDescriptor(port))
{
serverSocket->startServerEncryption();
}
else
{
delete serverSocket;
}
}
void PolaczenieSSL::gotowy()
{
qDebug()<<"gotowy";
}
{
qDebug()<<"Stan: "<<state;
}
{
qDebug()<<"Blad: "<<err;
}
void PolaczenieSSL::bledySSL(QList<QSslError> l)
{
for(int i=0;i<l.size();++i)
qDebug()<<"BladSSL: "<<l.at(i);
}
#include "polaczeniessl.h"
PolaczenieSSL::PolaczenieSSL(QWidget *parent)
{
}
PolaczenieSSL::~PolaczenieSSL()
{
}
void PolaczenieSSL::incomingConnection(int port)
{
qDebug()<<"incomingConnection";
QSslSocket *serverSocket = new QSslSocket;
connect(serverSocket, SIGNAL(encrypted()), this, SLOT(gotowy()));
connect(serverSocket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),SLOT(stany(QAbstractSocket::SocketState)));
connect(serverSocket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(bledy(QAbstractSocket::SocketError)));
connect(serverSocket,SIGNAL(sslErrors(QList<QSslError>)),this,SLOT(bledySSL(QList<QSslError>)));
connect(serverSocket,SIGNAL(sslErrors(QList<QSslError>)), serverSocket, SLOT(ignoreSslErrors()));
serverSocket->setProtocol(QSsl::AnyProtocol);
/*
QFile *file = new QFile("server.key");
QSslKey key(file, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, "server");
serverSocket->setPrivateKey(key);
serverSocket->setLocalCertificate("server.csr");
serverSocket->addCaCertificates("/etc/ssl/certs");
*/
if (serverSocket->setSocketDescriptor(port))
{
serverSocket->startServerEncryption();
}
else
{
delete serverSocket;
}
}
void PolaczenieSSL::gotowy()
{
qDebug()<<"gotowy";
}
void PolaczenieSSL::stany(QAbstractSocket::SocketState state)
{
qDebug()<<"Stan: "<<state;
}
void PolaczenieSSL::bledy(QAbstractSocket::SocketError err)
{
qDebug()<<"Blad: "<<err;
}
void PolaczenieSSL::bledySSL(QList<QSslError> l)
{
for(int i=0;i<l.size();++i)
qDebug()<<"BladSSL: "<<l.at(i);
}
To copy to clipboard, switch view to plain text mode
It is not working.
incomingConnection
incomingConnection
Stan: QAbstractSocket::ConnectedState
Blad: QAbstractSocket::SocketError( 13 )
Stan: QAbstractSocket::UnconnectedState
To copy to clipboard, switch view to plain text mode
Bookmarks