我注意到我的两个Qt应用程序中的这个输出使用QNetworkRequest通过QNeworkRequest从外部加载一些数据:
QSslSocket: cannot resolve TLSv1_1_client_method
QSslSocket: cannot resolve TLSv1_2_client_method
QSslSocket: cannot resolve TLSv1_1_server_method
QSslSocket: cannot resolve TLSv1_2_server_method
QSslSocket: cannot resolve SSL_select_next_proto
QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
Run Code Online (Sandbox Code Playgroud)
导致出现这些警告的请求的一个示例是
QNetworkReply reply = m_nam->get(QNetworkRequest(QUrl("http://api.openweathermap.org/data/2.5/forecast?id=2835297&mode=xml")));
Run Code Online (Sandbox Code Playgroud)
我有理由相信任何查询都没有TLS/SSL,都是普通的HTTP.无论URL如何,消息始终在分派第一个请求后出现.我根本不打算使用SSL,代码中没有提到SSL,这意味着我不能以编程方式忽略警告.
我的设置是Windows 7 64位,MSVC2013和MinGW,Qt 5.3.2.无论使用何种编译器,都会显示消息.未安装OpenSSL或其他SSL开发库.
问题是:我如何摆脱这些警告?
我使用Qt Creator 4.2.0运行Qt 5.7.1(MSVC 2015,32位).我有问题QSslSocket.我收到以下错误:
qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
Run Code Online (Sandbox Code Playgroud)
我去了以下位置openssl github并下载了zip文件.我已将"libeay32.dll"和"ssleay32.dll"文件移到我的发布目录中,我仍然遇到这些错误.有没有人QSslSocket能够让我的步骤让套接字工作或有任何建议?
我正在尝试开发一个程序,可以连接到谷歌地图,并使用谷歌地图GPS参数获取地图.所以我有一个问题,当我编译代码并单击运行按钮时,我在应用程序输出中看到这些错误:
QSslSocket:无法解析TLSv1_1_client_method
QSslSocket:无法解析TLSv1_2_client_method
QSslSocket:无法解析TLSv1_1_server_method
QSslSocket:无法解析TLSv1_2_server_method
我搜索了很多,但无法找到任何答案,我也试图安装open-ssl v1.0.1和v .98,但仍然没有.
MY Qt版本:Qt Creator 3.0.1基于Qt 5.2.1
这是我的代码:
MainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QUrl>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QString>
#include <QPixmap>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_pushButton_clicked();
void imageloaded(QNetworkReply *);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
Run Code Online (Sandbox Code Playgroud)
Mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this); …Run Code Online (Sandbox Code Playgroud) 我在debian wheezy的Qt 5.4.1中使用QSslSocket创建了一个sslclient和sslserver.当我运行程序时,他们根本不工作.在调试我的代码后,我看到它在尝试从中创建一个新对象时,在约束器中QSslSocket返回此错误(cannot resolve SSLV2_client_method).
这是我的代码块:
SSlClient::SSlClient(QObject *parent) : QObject(parent)
{
client = new QSslSocket(this);
client->setProtocol(QSsl::SslV3);
connect(client, SIGNAL(encrypted()), this, SLOT(startTransfer()));
connect(client, SIGNAL(encryptedBytesWritten(qint64)), this, SLOT(byteWritten()));
}
Run Code Online (Sandbox Code Playgroud) 是否可以创建一个新的QSslSocket并使其获得现有TCP连接的所有权,并且旧的QTcpSocket将被丢弃,而不会中断或关闭TCP连接?
我需要这个在我的FTP服务器中实现显式FTPS,这要求最初连接是未加密的,并且只有在FTP客户端的请求(命令AUTH SSL或AUTH TLS)时,如果它发生,则启动SSL/TLS握手.
我想用 QSslSocket 连接服务器,在服务器上我得到 soketSslError “证书是自签名的,并且不受信任”,但我不明白为什么会出现此错误。
第一步是使用 openssl 为服务器和客户端生成文件
$openssl req -new -newkey rsa:1024 -keyout ca.key -x509 -days 500 -out ca.crt
$openssl req -new -newkey rsa:1024 -keyout client01.key -out client01.csr
$openssl ca -config ca.config -in client01.csr -out client01.crt -batch
Run Code Online (Sandbox Code Playgroud)
在C++服务器/客户端中
在服务器上:
启动服务器
if (listen(QHostAddress::Any,this->connectingPort)) {
std::cout<<"Server start on port: "<<this->connectingPort<<std::endl;
return true;
} else {
std::cout<<"Cant start server. "<<errorString().toStdString().c_str()<<std::endl;
return false;
}
Run Code Online (Sandbox Code Playgroud)
传入连接
QFile keyFile("ca.key");
if (!keyFile.open(QIODevice::ReadOnly)) {
delete this->sslSocket;
qDebug()<<"Cant open file: "<<keyFile.fileName();
return false;
}
QByteArray pasp ="qwerty";
QSslKey …Run Code Online (Sandbox Code Playgroud) 我有一个正在使用的客户端 - 服务器应用程序QTcpSocket.现在我想使用加密的SSL连接,因此我尝试切换到QSslSocket.但我无法建立与服务器的连接.这是客户端的代码:
ConnectionHandler::ConnectionHandler(QString ip, int port, QObject *parent) : QObject(parent) {
// connect(this->socket, SIGNAL(connected()), this, SLOT(connected()));
connect(this->socket, SIGNAL(disconnected()), this, SLOT(disconnected()));
connect(this->socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(this->socket, SIGNAL(encrypted()), this, SLOT(encryptedReady()));
connect(this->socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(SSLerrorOccured(const QList<QSslError> &)));
connect(this->socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
connect(this->socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
this->ip = ip;
this->port = port;
}
void ConnectionHandler::socketStateChanged(QAbstractSocket::SocketState state) {
qDebug() << state;
}
void ConnectionHandler::socketError(QAbstractSocket::SocketError) {
qDebug() << this->socket->errorString();
}
void ConnectionHandler::encryptedReady() {
qDebug() << "READY";
}
void ConnectionHandler::SSLerrorOccured(const …Run Code Online (Sandbox Code Playgroud)