简体   繁体   English

如何确定我的连接是否使用SSL?

[英]How can I tell if my connection is using SSL?

I'm using code from a demo program using Devart's MyDac component using Delphi 2009 to connect to a remote database using SSL. 我正在使用来自演示程序的代码,该程序使用了Devart的MyDac组件,并使用了Delphi 2009,以使用SSL连接到远程数据库。

I have made and verified the certificates and keys and set the connection parameters in MyDAC to use them eg 我已经制作并验证了证书和密钥,并在MyDAC中设置了连接参数以使用它们,例如

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. 当我告诉MyConnection进行连接(在设置用户名/密码等之后)时,它毫无问题地连接到数据库。 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. 但是,作为测试,我故意输入了无效的密钥名称'C:\\ XXXclient-key.pem,它仍然可以正常连接,所以也许根本就没有使用SSL。

So my question is: 所以我的问题是:

How can I use Delphi to detect if a connection is really using SSL or not? 如何使用Delphi检测连接是否确实使用SSL?

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; 看来是sql语句;

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. 可以提供帮助,因为如果不使用ssl,则其值为空;如果不使用ssl,则包含一个值。 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. 麻烦的是我正在使用的Mysql服务器(ISP Nativespace)甚至都没有名为Ssl_cipher的变量名,因此看起来无论如何它都不支持ssl。 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. 使用另一个ISP尝试相同的操作时,我确实看到了变量名,但是它没有值,这表明即使可以,它也没有使用ssl。

It now appears that there is much more that needs doing before a ssl connection can be set up. 现在看来,在建立ssl连接之前还需要做更多的事情。 Creating a new user on the db that only ever uses ssl, setting up permissions for them, running code on the server etc. 在仅使用ssl的数据库上创建一个新用户,为其设置权限,在服务器上运行代码等。

Not at all as simple as Devart's web page on securebridge leads one to believe! 根本不像Devart在securebridge上的网页那么简单,让人相信!

"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! 嗯...不完全是!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM