Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2005
    Posts
    74

    Unanswered: Encrypt/decrypt MS SQL 2005

    hi guyz!! is it posible to ecnrypt data everytime i insert it to a table and decrypt it everytime I select it using the MS SQL 2005 alone?

    like for example i have this query statement below
    Code:
    insert username,password users values ('daimous','my_password')
    what i want is every time i insert a value to the password column that value should be encrypted first.

    Code:
    select username,password from users
    everytime i select the value of the password column should decrypted.
    Thanks in advance!!!

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Passwords should never need to be decrypted.

    The standard method of handling them is to store the encrypted value in the database. When a user logs in, the password they submit is encrypted using the same algorithm and compared to the stored encrypted value.

    Passwords can thus use one-way encryption algorithms, which are more secure than two-way algorithms.

    If you would like a function for one-way password encryption, I can post one for you.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    SQL 2005 comes with two functions "EncryptByKey" and "DecryptByKey". If you have BOL installed on your machine, look over this article:
    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/38e9bf58-10c6-46ed-83cb-e2d76cda0adc.htm

  4. #4
    Join Date
    Sep 2005
    Posts
    74
    how can i check is BOL is installed in my sql server?

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Query Analyzer/help.

    And it should be in your Windows Start menu as well.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Sep 2005
    Posts
    74
    Does SQL Express 2005 edition has it?

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Dunno. But here it is on Microsoft's site, and I'm sure you can download it somewhere. I downloaded 2005's Books Online.
    http://msdn.microsoft.com/library/de...ga-gz_4z51.asp
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  8. #8
    Join Date
    Sep 2005
    Posts
    74
    I've already got an idea on how to encrypt data by using the EncryptByKey but when i try to decrpyt it using the DecryptByKey it doesn't return the original text. I've already posted that problem HERE. COuld anyone help me on this..thanks!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •