Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Password encryption-decryption logic in SQL Server 2005 Expand / Collapse
Author
Message
Posted Friday, June 13, 2008 7:34 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, May 5, 2010 10:47 PM
Points: 93, Visits: 98
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!!!!
Post #516677
Posted Friday, June 13, 2008 7:45 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 3:56 PM
Points: 33,182, Visits: 15,320
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.








Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #516695
Posted Friday, June 13, 2008 7:55 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, October 15, 2010 8:23 AM
Points: 371, Visits: 437
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.


Post #516715
Posted Friday, June 13, 2008 8:17 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, May 5, 2010 10:47 PM
Points: 93, Visits: 98
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.
Post #516743
Posted Friday, June 13, 2008 8:40 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, October 15, 2010 8:23 AM
Points: 371, Visits: 437
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

Post #516766
Posted Friday, June 13, 2008 9:02 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, May 5, 2010 10:47 PM
Points: 93, Visits: 98
Thanks Jamie!!!:)
Post #516803
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse