If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to save string (username password) in encrypted form in Mysql database,

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-24-11, 02:59
rohitamitpathak rohitamitpathak is offline
Registered User
 
Join Date: Feb 2011
Location: india- new delhi
Posts: 31
How to save string (username password) in encrypted form in Mysql database,

Good morning all,
I am using c++ and also using wxWidget, In backend i m using MySql C API, i want to save user name and password in encrypted form inside the database,
when user will try to login,I will decrypt the data for authentication,
1-Is there any headerfiles in c++ who can handle encryption or decryption?
2-is there any functions in mysql who can save the data in encrypt form and decrypt the data when required?
__________________
Amit Pathak
S/w Developer
Zero Systems Pvt Ltd..
Reply With Quote
  #2 (permalink)  
Old 03-24-11, 03:50
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
Hi,

this is certainly one way of achieving a login solution. However, a more robust solution is store the encrypted password in the database and compare the encrypted password from your application with that in the database.

MySQL provides MD5() function which encrypts a string. MD5 is a one way hashing algorithm i.e. once hashed you can never get back your original string. If the password being passed in is also encrypted with MD5 and you compare the same string in the database with your passed in string. If they match you have a login.

It just means that when someone forgets their password you have to assign a new password for them, you cannot read their password from the database.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #3 (permalink)  
Old 03-24-11, 03:59
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
Reading up about MD5, as technology advances using brute force methods on every string will take less and less time, but for the majority of cases this is sufficient. Failing that there is another function called SHA and SHA2. MySQL 5.1 offers a full range of security functions:

MySQL :: MySQL 5.1 Reference Manual :: 11.13 Encryption and Compression Functions
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Tags
c++, mysql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On