Using SQL Commands

When to use this feature: You may not even need this functionality. If a database encrypted without schema protection (only data-at-rest encryption) the functionality isn't required.
Alternatively, you may grant access by login.


DbDefence encrypts a database and allows access only to authorized connections. By default, we primarily designed DbDefence to allow access only to CONNECTIONS that successfully execute the command OPEN SYMMETRIC KEY DBDX DECRYPTION BY PASSWORD = 'yourpassword'

Access is allowed only for the connection that has successfully executed the OPEN SYMMETRIC KEY statement. In the case of a reconnection, you will need to re-open the key again. This is the most secure way of accessing an encrypted database compared to the other two options listed below. You can explicitly call a CLOSE SYMMETRIC KEY statement to close access at any time after opening a connection. The key is closed automatically when the connection is closed.

An example of how to execute a statement from

C#

SqlCommand cmd = new SqlCommand("open symmetric key dbdx decryption by password='MyPassword'", objConnection);
cmd.ExecuteNonQuery();

VB.NET

Dim command As New SqlCommand("open symmetric key dbdx decryption by password='MyPassword'", connection)
command.ExecuteNonQuery()

Classic ASP

Set Cmd=Server.CreateObject("ADODB.Command")
Cmd.ActiveConnection = Conn
Cmd.CommandText = "open symmetric key dbdx decryption by password='MyPassword'"
Cmd.Execute