|
Hello,
In my entity, there are several properties which I want to encrypt in the database. After loading the entity back from the database, the properties should be "automatically" decrypted, transparent for the UI and Business Layer.
I tried to use ILifecycle.OnLoad() to decrypt and ILifecycle.OnSave() / OnUpdate() to encrypt. Decrypting is not a problem and works fine.
However, if I encrypt the data using
LifecycleVeto ILifecycle.OnUpdate(ISession s) { this.Password = CryptographyHelpers.Encrypt(this.Password); // "Password" is a string property in my entity }
the encrypted string doesn't get persisted in the database. Instead, if I look at the database table, the Password column still has the cleartext value.
Is there any alternative approach? I'm not very experienced in using NHibernate so forgive if I overlook the obvious...
Thanks for any help
Urs
|