Programmers sometimes need to store user password and some other fields in database data table in encrypted format. There exists an easy way to do this. I have used in my database. In my system, I have a table called Users which contains fields: UserID, UserName, Password,and Email. I have encrypted the password field.
[While continuing the journey, you may also be interested in implementing object relational database features of Oracle illustrated for a simple ecommerce database.]
With this scenario, I get following issues to be solved.Encrypt input password before inserting into data table.Decrypt password before reading it.
For all these requirements I use two functions, one for encrypting password and another for decrypting password.
--create two function: one for encrypt--the other for decrypt:
FUNCTION encrypt( iValue in varchar2, iKey in varchar2 )
return varchar2
is
vEncrypted varchar2(4000);
begin
-- encrypt input string
dbms_obfuscation_toolkit.desencrypt (input_string => iValue,
key_string => iKey,
encrypted_string => vEncrypted);
return vEncrypted;
end;/
FUNCTION decrypt( iValue in varchar2, iKey in varchar2 )
return varchar2
is
vDecrypted varchar2(4000);
begin
-- decrypt input string
dbms_obfuscation_toolkit.desdecrypt (input_string => iValue,
key_string => iKey,
decrypted_string => vDecrypted);
return vDecrypted;
end/
Tuesday, July 22, 2008
How to encrypt decrypt password in Oracle data table?
Labels:
Oracle Database
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Most of the times programmers fill the DataTable from database. This action fills the schema of the database table into the DataTable . We ...
-
I have found much tricks in different tutorials and forums on opening new window in asp.net web page, using JavaScript, jquery etc. Here I h...
-
The asp.net Eval() and Bind() expressions are heavily used in asp.net GridView and DetailsView data bound controls. The difference between ...
-
I have oracle database installed in my computer. My Operating system is XP. I wrote an application in asp.net. It connected to oracle databa...
-
Last time I got the following error: HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related ...
-
Last time we talked about Refreshing the parent page from child window in asp.net using javascript . This technique is useful in many scenar...
-
We do have a folder (and a number of sub folders) with a number of various files in those folders (and sub folders). Now we do need to list ...
-
In this post, I am explaining the button click functionality on key press in a textbox. I am using javascript to link the input textbox and ...
-
Much often we open child windows from parent web page . In the child page we perform some activities, and later close the window. At the ver...
-
The default behaviour of asp.net gridview is that it hides both Gridview header and footer when no data is present. You can note the absence...
2 comments:
Really Impressive...
I have a question on the key used to decrypt the password. How to secure this key?
Post a Comment
Hope you liked this post. You can leave your message or you can put your valuable suggestions on this post here. Thanks for the sharing and cooperation!