I'm not very good at SSL principles, but just want encryption to work for me. I have a database and a user with the query "REQUIRE X509". The necessary certificates have been created as described in the MySQL docs, and work well - I can connect to the server from the Windows command line.
The problem occurs when I try to do the same from my program using the MySQL Client API (without SSL, the program also works fine). Used block: http://www.audio-data.de/mysql.html .
These are my actions: 1) if I just add the mysql_ssl_set () call (with the appropriate parameters) to mysql_real_connect (), the latter gives a general SSL connection error. 2) MySQL docs in en / mysql-ssl-set.html say that the function always returns 0. But when I checked this, it turned out that the result is the number 11150848. Then I wrote it like this:
showmessage(inttostr(mysql_ssl_set(mys, '.\certs\client-key.pem', '.\certs\client-cert.pem', '.\certs\ca-cert.pem', nil)));
... and repeated the line 8 times. Each time he returned a slightly larger number - 11158528, 11158784, 11159040, ... and two zeros for the last two calls.
After which mysql_real_connect () was finally successful! The program even managed to fulfill some queries, return the correct results for them (I know the data), but then it crashed with an access violation: writing an address ... in some place. The critical point varied between runs and small changes in the code.
. MySQL 5.0 5.1 Windows ( 5.1 Linux , 5.0 mysql- SSL ), .
- ? .