Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Need a HowTo for setting SSL certificates for a MySQL Connection - QT5

$
0
0
Hello all ! I am trying to use SSL certificates with mysql. My code works until i add this part :     QVariant v = base_de_donnees.driver()->handle();     if (v.isValid() && qstrcmp(v.typeName(), "MYSQL*")==0)     {         MYSQL *handle = static_cast<MYSQL *>(v.data());         if (handle != NULL)         {             base_de_donnees.driver()->handle();             mysql_ssl_set(handle, "/Users/jeh/Desktop/certs/client-key.pem","/Users/jeh/Desktop/certs/client-cert.pem",                           "/Users/jeh/Desktop/certs/ca-cert.pem", NULL, "DHE-RSA-AES256-SHA");         }     } (by the way, base_de_donnees is a QSqlDatabase object) between my base_de_donnees = QSqlDatabase::addDatabase("QMYSQL"); and my base_de_donnees.open(); Without this code, my app can connect to my MySQL database with a user that requires ssl, but when i add the code, it doesn’t work anymore. The program fails when i try to compile it because the mysql_ssl_set symbol is not found for my architecture. My class file includes <mysql.h> and <QtSql> I just want to use my cert files to be sure of my clients apps. Is there a way to do this ? Thank you for reading. PS : to use my ssl remote user i use this : (and it works) base_de_donnees.setConnectOptions("CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1"); PS : when i use Wireshark, my request are hidden but i can see that my trafic is recognized as mysql, even if i can’t have any information about it. My aim is to hide it totally by using the cert files, without using a third party software with my app. I tried to have a look to QsslSocket, but i don’t know how to bind the ssl socket and the mysql requests.

Viewing all articles
Browse latest Browse all 18427

Trending Articles