Click here to Skip to main content
Email Password   helpLost your password?
EncryptedStringType is a simple NHibernate user type class that can be used when you need to store a string value into database encrypted. For example, password property or credit card number property, most developer only store the encrypted string of the values of such properties. With the EncryptedStringType class it's now extremely easy. You no longer need to manually encrypt and decrypt such properties.
Your property code is not different from any other property
        private string password;

 
        public string Password {
            get { return password; }

            set { password = value; }
        }
You map it with the following line in hbm file:
 <property name="Password" type="MindHarbor.MiscNHibernateUserTypes.EncryptedStringType,MindHarbor.MiscNHibernateUserTypes"/>

That's it, the value will be stored in your database encrypted. You can query it as normal properties, basically your code does not even know the value is stored in the database encrypted. To use this user type, you can download the MindLib package, in the /bin folder there are a couple of dlls needed: EncryptionClassLibrary.dll, MindHarbor.GenClassLib.dll, MindHarbor.GenlInterfaces.dll, MindHarbor.MiscNHibernateUserTypes.dll, LumenWorks.Framework.IO.dll
The source code is also available in the /src folder, the solution file is MiscNHibernateUserType.sln
You must Sign In to use this message board.
 
 
Per page   
  
-- There are no messages in this forum --


Last Updated 23 Jan 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010