Tengo un problema que no doy con la solución, estoy intentando acceder a un sitio (https) mediante QNetworkAccesManager, Estoy Usando PyQt5 (compilado por mi) en Python 2.7.14 32Bit
mi código es este:
from PyQt5.QtCore import QUrl, QCoreApplication
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
app = QCoreApplication([])
nam = QNetworkAccessManager()
req = QNetworkRequest(QUrl('https://www.google.es'))
resp = nam.get(req)
def downloadProgress(bytesReceived, bytesTotal):
print 'Descargado: %s de %s' % (bytesReceived, bytesTotal)
def sslErrors(errors):
for error in errors:
print error.errorString()
resp.sslErrors.connect(sslErrors)
resp.downloadProgress.connect(downloadProgress)
app.exec_()
y esto es lo que me muestra en la consola:
The host name did not match any of the valid hosts for this certificate
The signature of the certificate is invalid
The signature of the certificate is invalid
Descargado: 0 de 0
Alguna sugerencia? he probado todo lo que he visto por ahí pero nada parece funcionar.
EDITO:
Añado esta información por si aclara algo:
>>> from PyQt5.QtNetwork import QSslSocket
>>> QSslSocket.supportsSsl()
qt.network.ssl: QSslSocket: cannot resolve ERR_peek_last_error
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
qt.network.ssl: QSslSocket: cannot resolve CONF_get1_default_config_file
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve EC_KEY_get0_group
qt.network.ssl: QSslSocket: cannot resolve EC_GROUP_get_degree
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_new
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_free
qt.network.ssl: QSslSocket: cannot resolve EVP_CipherInit_ex
qt.network.ssl: QSslSocket: cannot resolve EVP_PKEY_set1_EC_KEY
qt.network.ssl: QSslSocket: cannot resolve EVP_PKEY_get1_EC_KEY
qt.network.ssl: QSslSocket: cannot resolve PEM_read_bio_ECPrivateKey
qt.network.ssl: QSslSocket: cannot resolve PEM_write_bio_ECPrivateKey
qt.network.ssl: QSslSocket: cannot resolve PEM_read_bio_EC_PUBKEY
qt.network.ssl: QSslSocket: cannot resolve PEM_write_bio_EC_PUBKEY
qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_client_callback
qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_server_callback
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_use_psk_identity_hint
qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected
qt.network.ssl: QSslSocket: cannot resolve EC_KEY_dup
qt.network.ssl: QSslSocket: cannot resolve EC_KEY_new_by_curve_name
qt.network.ssl: QSslSocket: cannot resolve EC_KEY_free
qt.network.ssl: QSslSocket: cannot resolve EC_get_builtin_curves
qt.network.ssl: QSslSocket: cannot call unresolved function CONF_get1_default_config_file
qt.network.ssl: QSslSocket: cannot call unresolved function OPENSSL_add_all_algorithms_conf
True
Vale, ya he dado con la solución la versión con la que está compilado Qt y la que tenia instalada en el sistema no coincidían
QSslSocket.sslLibraryVersionString()
QSslSocket.sslLibraryBuildVersionString()
he tenido que actualizar los archivos libeay32.dll y ssleay32.dll de C:\Windows\SysWOW64
pero mi pregunta es, puedo indicarle a Qt la ruta de openssl si quiero usar otra versión diferente a la que tengo instalada en el sistema?