Quantcast

Maximum PC

It is currently Wed Nov 26, 2014 4:40 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: store connection parameters for SQL database on Windows?
PostPosted: Thu Sep 25, 2014 8:01 am 
Willamette
Willamette

Joined: Tue Feb 01, 2005 12:17 pm
Posts: 1489
I'm writing a database app connects to Microsoft SQL Server (the application is a desktop Windows program), and I've created my own login system, which the user's credentials are stored in an ecrypted state in the database.

The registry? How can I go about storing an ecrypted password in the registry, or is there a better option? (This is the username/password combination that the application sends to the database so it can access the Users table and retrieve the username/password info for authorization/authentication).

The account that is being used by the app is a very limited account, and can only read the User's table (cannot INSERT, DELETE or UPDATE; only SELECT).

Where can I store this connection info in the registry so that I don't have to pre-program/hard-code into the program?


Top
  Profile  
 
 Post subject: Re: store connection parameters for SQL database on Windows?
PostPosted: Mon Oct 06, 2014 11:49 am 
8086
8086

Joined: Tue Jun 29, 2004 9:48 am
Posts: 53
what programming API are you using? .NET? MFC? Java?

You could use a config text file or ini file in the executable directory and just read the file every time. If your worried about security, you can encrypt the file.


Top
  Profile  
 
 Post subject: Re: store connection parameters for SQL database on Windows?
PostPosted: Mon Oct 06, 2014 1:09 pm 
Willamette
Willamette

Joined: Tue Feb 01, 2005 12:17 pm
Posts: 1489
I'm using .Net (Visual C# specifically and MS SQL Server). I would rather not put them in a text file or any other readable file for that matter simply because I might as well just give the password to the user. For now, I think I will hard-code them into the application (it will only be used by a handful of employees, so it's not a web app or anything that will be used by the public).

I suppose that the registry would be a little better since many general users aren't going to go snooping around the registry, and they'd also have to sort of know what they were looking for. Neither is an ideal choice, but if I could find some way to store an encrypted string in the registry, that would work for the most part.

Hard-coding will work for now, but can get to be a pain if I have to change the database name and/or password sometime in the future, thus causing me to have to re-build the application and re-distribute the app to each machine. For now, I'll just create a global constant that only needs to be updated in once place in the entire application's source code (not the best idea, but the most feasible at this time).

Any other ideas? Can you store a string that is encrypted into the Windows registry?


Top
  Profile  
 
 Post subject: Re: store connection parameters for SQL database on Windows?
PostPosted: Tue Oct 07, 2014 7:24 pm 
Smithfield
Smithfield

Joined: Sun Jun 18, 2006 7:37 pm
Posts: 5469
Keep your password as a salted MD5 hash. Then store that.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.