How to detect (or set) encryption

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Nicklas
Posts: 1
Joined: Fri 26 Sep 2008 09:08

How to detect (or set) encryption

Post by Nicklas » Fri 26 Sep 2008 09:25

I want to detect if encryption is being used or not when a connection has been established to the server. How would I do that?

Current setup (that works encrypted - tested using a packet sniffer):
Server running MSSQL 2000 SP4 with an installed certificate and "Force protocol encryption" is checked.
Client using TMSConnection with defaults.

Ok, so far so good... But now I want to check if the connection is really encrypted in code at the client, how would I do that?
- The Options.Encrypted property has not been changed...
- The ConnectionString has not been changed...
- I cannot find any property to detect if the current connection is really encrypted or not...

A related question: Why does it not work if I force encryption on the client?
- I mean, I've sniffed the traffic and the connection is encrypted if "Force protocol encryption" is checked on the server and "Options.Encrypt := False" is set on the client... But I cannot connect if I specify "Options.Encrypt := True" on the client.
I think that's quite strange... I mean, obviously the encryption works...

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 01 Oct 2008 14:19

TMSConnection does not allow to get know if there was established encrypted connection by server side initiation.
To establish encrypted connection on the client you should set Options.Encrypt to True. In this case you should have a valid Certificate Server in your network environment.

You can find more detailed information about enabling encryption for SQL Server by the following link:
http://support.microsoft.com/kb/276553

Post Reply