S
extern QString CIPHER_LIST;
QSslServer::QSslServer(QObject *parent)
: QTcpServer(parent)
{
}
QSslServer::~QSslServer()
{
}
void QSslServer::incomingConnection(qintptr socketDescriptor)
{
QSslSocket *socket = new QSslSocket();
QSslConfiguration config = socket->sslConfiguration();
if(!CIPHER_LIST.isEmpty())
{
QList<QSslCipher> tmpl;
const auto cipherNames = CIPHER_LIST.split(QLatin1Char(':'), QString::SkipEmptyParts);
for (const QString &cipherName : cipherNames)
{
QSslCipher cipher(cipherName);
if (!cipher.isNull())
tmpl << cipher;
}
config.setCiphers(tmpl);
}
//if(!CIPHER_LIST.isEmpty())
// socket->setCiphers(CIPHER_LIST);
socket->setSslConfiguration(config);
socket->setSocketDescriptor(socketDescriptor);
emit newPeerConnected(socket);
}