简体   繁体   English

如何处理QSslSocket:无法解决TLSv1_1_client_method错误

[英]How to handle QSslSocket: cannot resolve TLSv1_1_client_method error

I'm trying to develop a program that can connect to google map and get the map by using google map GPS parameters. 我正在尝试开发一个程序,可以连接到谷歌地图,并使用谷歌地图GPS参数获取地图。 so i have one problem , when i compile the code and click the run button i see these errors in the application output: 所以我有一个问题,当我编译代码并单击运行按钮时,我在应用程序输出中看到这些错误:

QSslSocket: cannot resolve TLSv1_1_client_method QSslSocket:无法解析TLSv1_1_client_method

QSslSocket: cannot resolve TLSv1_2_client_method QSslSocket:无法解析TLSv1_2_client_method

QSslSocket: cannot resolve TLSv1_1_server_method QSslSocket:无法解析TLSv1_1_server_method

QSslSocket: cannot resolve TLSv1_2_server_method QSslSocket:无法解析TLSv1_2_server_method

i googled a lot but could'nt find any answer , i also tried to install open-ssl v1.0.1 and v .98 but still got Nothing. 我搜索了很多,但无法找到任何答案,我也试图安装open-ssl v1.0.1和v .98,但仍然没有。

MY Qt version : Qt Creator 3.0.1 Based on Qt 5.2.1 MY Qt版本:Qt Creator 3.0.1基于Qt 5.2.1

Here is my code : 这是我的代码:

MainWindow.h 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

Mainwindow.cpp Mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{

    QString gmurl;
    gmurl = "http://maps.googleapis.com/maps/api/staticmap?center=35.704465,51.409597&zoom=16&size=600x600&sensor=false&markers=color:red%7Clabel:S%7C35.704465,51.409597" ;
    QUrl url(gmurl);
    QNetworkRequest request(url);
    QNetworkAccessManager manager;
    manager.get(request);
    connect(&manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(imageloaded(QNetworkReply*)));




}

void MainWindow::imageloaded(QNetworkReply *reply){


    QByteArray data = reply->readAll();
    reply->deleteLater();
    QPixmap pixmap;
    pixmap.loadFromData(data);
    ui->label->setPixmap(pixmap.scaled((600,600),Qt::KeepAspectRatio));
}

Thanks a lot. 非常感谢。

These warnings are printed by Qt (Qt Network specifically) when it loads the OpenSSL libraries at runtime, but does not find the above mentioned functions in them (probably because the OpenSSL libraries found are too old). 这些警告在运行时加载OpenSSL库时由Qt(特别是Qt网络)打印,但未在其中找到上述功能(可能是因为找到的OpenSSL库太旧)。 They essentially mean that Qt was compiled with an OpenSSL version that supported TLS v1.1, v1.2, but that the OpenSSL libraries found on your system does support only up to TLS v1.0. 它们本质上意味着Qt是使用支持TLS v1.1,v1.2的OpenSSL版本编译的,但是系统中的OpenSSL库仅支持TLS v1.0。

The warnings are not fatal by itself (TLS 1.0 is still considered secure, and most servers will accept it), but are a hint that your application bundles outdated OpenSSL libraries, or relies on finding libeay32.dll, ssleay32.dll somewhere on the system (in PATH). 这些警告本身并不致命(TLS 1.0仍被认为是安全的,大多数服务器都会接受它),但暗示您的应用程序捆绑了过时的OpenSSL库,或依赖于在系统某处找到libeay32.dll,ssleay32.dll (在PATH中)。

If you want to avoid these warnings, either ship a very recent libeay32.dll, ssleay32.dll together with your application, or let Qt link in openssl statically (see Enabling and Disabling SSL Support in the Qt documentation on how to do this). 如果您想避免这些警告,请将最近的libeay32.dll,ssleay32.dll与您的应用程序一起发送,或者让Qt静态链接到openssl(请参阅Qt文档中的启用和禁用SSL支持 ,了解如何执行此操作)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Qt SSl错误(QSslSocket:无法解析TLSv1_1_client_method) - Qt SSl Error (QSslSocket: cannot resolve TLSv1_1_client_method) QSslSocket无法解决和权限被拒绝错误 - QSslSocket cannot resolve and Permission Denied error qt.network.ssl:QSslSocket:无法解析SSLv2_client_method - qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method C ++ Qt应用程序正常运行,但发出警告“ qt.network.ssl:QSslSocket:无法解析SSLv2_server_method” - C++ Qt application working but gives warning “qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method” QSslSocket:无法调用未解析的函数 - QSslSocket: cannot call unresolved function 如何使用带有函数指针的新QObject :: connect语法将QSslSocket :: error信号连接到插槽? - How to connect QSslSocket::error signal to slot using new QObject::connect syntax with function pointers? WinHttpSetOption() 设置 TLSv1.2 失败,错误代码为 ERROR_INTERNET_INCORRECT_HANDLE_TYPE - WinHttpSetOption() failed set TLSv1.2 with error code ERROR_INTERNET_INCORRECT_HANDLE_TYPE 使用 libmosquitto 的客户端使用 TLS 获取“tlsv1 警报内部错误”,在没有 TLS 的情况下工作正常 - Client using libmosquitto gets "tlsv1 alert internal error" using TLS, works fine without TLS 如何解决链接器错误“找不到-lgcc_s” - How to resolve linker error “cannot find -lgcc_s” 如何解决VC ++ 9中的编译错误“无法将const转换为引用” - How to resolve compilation error “cannot convert const to reference” in VC++9
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM