Encrypting column values

  • I want to store a function in SQL Server database that when called during insertion, encrypts a value and then stores encrypted text in the column.

    Is there any built in Encrypting and Hashing mechanism in SQL 2005.

    "Here is a test to find out whether your mission in life is complete. If you're alive, it isn't. "

    Richard Bach

  • There many ways to do that in SQL server. It depends on what usage is required for Encryption.

    As an example, if you prefer not to store clear text passwords in the db, the best way to do is to convert the clear text on insert to hasbytes. The data that will sit in the DB will be in a form that is not going to identified by an user or dba.

    Once you use hasbytes, there is no way to ever getting back the clear text. In order to validate a password a user enters is to run the same hashbytes function when doing a select.

    The alternative is to use encryption keys. This may be required when you may need to keep data like (ss#) in an encryption format but if you need to access, one can access it by using decryption method.

    All these functionalities are part of sql server 2005.

    hope this helps.

  • encryptbypassphrase() works, but a better method is to create keys and use those for encryption. That way you can assign rights to use the keys to users.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply