Unable to connect to MSSQL due to certificate too weak
-
I'm trying to connect to an MSSQL database with this code:
QSqlDatabase _db; bool OdbcSql::connectToDB(QUrl host, QString database, QString username, QString password) { _db.setDatabaseName(QStringLiteral("Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1; Server=%1;Database=%2").arg(host.url()).arg(database)); _db.setUserName(username); _db.setPassword(password); _db.setConnectOptions("SQL_ATTR_CONNECTION_TIMEOUT=5;SQL_ATTR_LOGIN_TIMEOUT=5"); bool ret = _db.open(); if (!ret) _db.lastError(); return ret; }
I get this error:
QSqlError("", "QODBC: Unable to connect", "[Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:0A000086:SSL routines::certificate verify failed:EE certificate key too weak] [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection")
I'm using Qt 6.2.0 under Ubuntu 22.04
Any idea of what does "EE certificate key too weak" mean? I did a google search but I don't understand of which certificate is talking about and if it is on my machine or on the remote one.How to fix it?
-
I'm trying to connect to an MSSQL database with this code:
QSqlDatabase _db; bool OdbcSql::connectToDB(QUrl host, QString database, QString username, QString password) { _db.setDatabaseName(QStringLiteral("Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1; Server=%1;Database=%2").arg(host.url()).arg(database)); _db.setUserName(username); _db.setPassword(password); _db.setConnectOptions("SQL_ATTR_CONNECTION_TIMEOUT=5;SQL_ATTR_LOGIN_TIMEOUT=5"); bool ret = _db.open(); if (!ret) _db.lastError(); return ret; }
I get this error:
QSqlError("", "QODBC: Unable to connect", "[Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:0A000086:SSL routines::certificate verify failed:EE certificate key too weak] [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection")
I'm using Qt 6.2.0 under Ubuntu 22.04
Any idea of what does "EE certificate key too weak" mean? I did a google search but I don't understand of which certificate is talking about and if it is on my machine or on the remote one.How to fix it?
@Mark81 said in Unable to connect to MSSQL due to certificate too weak:
I don't understand of which certificate is talking about
Nothing to do with Qt. The certificate here is the SSL certificate of the server, it's not secure enough to establish a secure connection. Either witch to non-SSL, unencrypted connection or update your server