From 28ceb2ea5e79d65904d2ad83b8259e75b60acff6 Mon Sep 17 00:00:00 2001 From: Olivier Delbeke Date: Mon, 8 Jun 2015 20:28:23 +0200 Subject: Added SSL support for MySQL database connections Addition of new options SSL_KEY, SSL_CERT, SSL_CA, SSL_CAPATH and SSL_CIPHER to allow SSL-encrypted connections to MySQL databases. When needed, these options must be specified in the function call QSqlDatabase::setConnectOptions() before the call to QSqlDatabase::open(). SSL_KEY = the path name to the key file SSL_CERT = the path name to the certificate file SSL_CA = the path name to the certificate authority file SSL_CAPATH = the path name to a directory that contains trusted SSL CA certificates in PEM format. SSL_CIPHER = a list of permissible ciphers to use for SSL encryption. These options replace CLIENT_SSL (which should not be used any more). Example: db.setConnectOptions("SSL_KEY=client-key.pem;" \ "SSL_CERT=client-cert.pem;" \ "SSL_CA=server-ca.pem"); [ChangeLog][QtSql] SSL support for MySQL database connections has been added. Option CLIENT_SSL replaced by SSL_KEY, SSL_CERT, SSL_CA, SSL_CAPATH and SSL_CIPHER, so that the keys, certificates and cipher can be specified. Task-number: QtBUG-3500 Change-Id: I8197234b169a818658678d6fcc953c90e83db23e Reviewed-by: Mark Brand --- src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sql/doc') diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp index c3b3b8e817..95422c9e7b 100644 --- a/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp +++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp @@ -80,7 +80,7 @@ if (db.open()) { //! [4] ... // MySQL connection -db.setConnectOptions("CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1"); // use an SSL connection to the server +db.setConnectOptions("SSL_KEY=client-key.pem;SSL_CERT=client-cert.pem;SSL_CA=ca-cert.pem;CLIENT_IGNORE_SPACE=1"); // use an SSL connection to the server if (!db.open()) { db.setConnectOptions(); // clears the connect option string ... -- cgit v1.2.3