Database side encryption via NHibernate

We are trying to encrypt a field using DB side encryption via NHibernate (most of the examples we came across are an application that is not what we would like). The issue has been raised a couple of times, but there are no answers yet.

In SQL Server 2005, for example, and forgetting about the key issues, for now it means INSERTing EncryptByKey (Key_GUID (MyKey), MyValueToEncrypt) and SELECTing DecryptByKey (MyEncryptedField). The property can be a string, whereas the field must be varbinary.

We are vaguely getting somewhere - using upper () and lower () functions instead of encryption functions - by combining paired properties, one being mapped to a custom type and the other to a formula attribute.

However, if anyone has any ideas on how to do this better, we'd really appreciate a few pointers: o)

+1


source to share


3 answers


Posted description of nasty hack on NHibernate forum



+1


source


There is a SourceForge project, MindLib, which has useful NHibernate functions and libraries. One of them is the EncryptedString library, which allows you to store an encrypted string. Unfortunately this is not done on the server side as you originally requested.

I was looking for something similar. The only thing I could think of was to create a user function in SQL Server to encrypt the string. Something like this .



MindLib EncryptedString

0


source


thanks for the tip! We support the MindLib approach as a last resort because it efficiently pushes data from the database into the application. As far as we can tell, TDE-compliant databases (such as SQL Server 2008 or Oracle 10.2) make the problem go away, but not all of our customers are ready to spike when upgrading; o)

0


source







All Articles