How can I tell if my connection is using SSL?

1k Views Asked by At

I'm using code from a demo program using Devart's MyDac component using Delphi 2009 to connect to a remote database using SSL.

I have made and verified the certificates and keys and set the connection parameters in MyDAC to use them eg

MyConnection.protocol := 'mpSSL';
MyConnection.SSLOptions.CACert := 'C:\ca-cert.pem';
MyConnection.SSLOptions.Cert := 'C:\client-cert.pem';
MyConnection.SSLOptions.Key := 'C:\client-key.pem';
MyConnection.SSLOptions.Chipherlist := 'All';

When I tell MyConnection to connect (after setting the user name / password etc) it connects to the database with no problems. However as a test I deliberately put in an invalid key name of 'C:\XXXclient-key.pem and it still connected OK so maybe it wasn't using SSL at all.

So my question is:

How can I use Delphi to detect if a connection is really using SSL or not?

1

There are 1 best solutions below

0
On

I think I'll close this question myself as it seem far more complex than I thought it was and I need much more information before this question makes sense. It appears that the sql statement;

SHOW STATUS LIKE 'Ssl_cipher'

can help as its value will be empty if its not using ssl or will contain an value if it is. The touble was the Mysql server I was using (ISP Nativespace) did not even have a variable name called Ssl_cipher so it looks like it doesn't support ssl anyway. Trying the same thing using another ISP I did see the variable name but it had no value, showing that was also not using ssl even I though it could do it.

It now appears that there is much more that needs doing before a ssl connection can be set up. Creating a new user on the db that only ever uses ssl, setting up permissions for them, running code on the server etc.

Not at all as simple as Devart's web page on securebridge leads one to believe!

"It is enough to place several components on the form and specify the server address and the user login information to establish a secure connection."

Err... not quite!