Password encryption-decryption logic in SQL Server 2005

  • I have passed the encrypted password in the connection string from my VB or VB.Net code.How to tackle this is SQL Server.I mean,how I define the decryption logic in SQL Server 2005?What should be the password of the login I passed in connection string (I hope it should be decrypted one only!!!).

    In short I want all the ways of implementing encryption-decryption in SQL Server 2005 interacting with VB6 or dotnet.

    Thanks i advance for your help!!!!

  • How are you encrypting things? Really you need the same algorithm on the server to provide the decrpytion. You could use one-way encryption, like MD5, and then just compare the encrypted versions. That might be the easiest way to do this. However then someone could send the encrypted value through.

  • You need to be a bit more clear on this..

    Encrypted string in an application and building a connection string?

    - decrypt password, build unencrypted connection string use that to connect.

    Connection string is encrypted in config file and you need to use it?

    - read encrypted data, unencrypt and use it.

    Either way, you need to build a class to handle your encryption requests, and your connection string you use needs to be clear text. Ado and OLE drivers cannot handle encrypted strings. There are new methods in .net2 to keep your connection string encrypted in your config file.

  • Hi Jamie,

    I will tell u the exact scenario....

    suppose the password of SQL Server Login is sqltest.I encrypted the password (to suppose "#[)^%#" based on my own logic) and made the conn string in VB6.........

    Now sql server login has password sqltest.Where will I define this encryption logic in SQL so that it can decrypt "#[)^%#" to sqltest for login success.

  • from what i understand, what you are trying to do isnt supported by any OLE/ODBC provider I know of. Usually you encrypt a password when saved in a file (like web.config or whatever), read it in your application, decrypt it, build connection string, connect to server.

    If you are concerned about plain text, etc, you need to encrypt your connection, or use integrated authentication instead (as integrated stores no password, its windows auth)

    secure connection:

    http://technet.microsoft.com/en-us/library/ms189067.aspx

  • Thanks Jamie!!!:)

Viewing 6 posts - 1 through 5 (of 5 total)

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