Encryptind and decrypting database column in oracle 10g

hi guys...
i am sai sandeep,i got a doubt how to encrypt a database column in oracle 10g..?
i am using a table " emp_uid " ,and strtucture as follows,
create table emp_uid(user_id varchar2(20),pwd varchar2(20));
i need to encrypt a pwd column in the emp_uid.
how to do it..?
thanking u  advance.....

Ok, here's a basic example...
SQL> create table myusers (username varchar2(30), password varchar2(40));
Table created.
SQL> create or replace procedure add_user(username in varchar2
  2                                      ,password in varchar2) is
  3  begin
  4    insert into myusers (username, password)
  5      values (add_user.username
  6             ,dbms_crypto.hash(utl_raw.cast_to_raw(add_user.username||'!'||add_user.password)
  7                              ,dbms_crypto.hash_sh1)
  8             );
  9    commit;
10  end;
11  /
Procedure created.
SQL> exec add_user('Fred','Fr3ddy')
PL/SQL procedure successfully completed.
SQL> select * from myusers
  2  /
USERNAME                       PASSWORD
Fred                           E5C975DB4C0A1CF65683E36421A6305F09F4EA9A
SQL> set serverout on;
SQL> create or replace procedure loginuser(username in varchar2
  2                                       ,password in varchar2) is
  3    v_hash     varchar2(40);
  4    v_username varchar2(30);
  5  begin
  6    v_hash := dbms_crypto.hash(utl_raw.cast_to_raw(loginuser.username||'!'||loginuser.password), dbms_crypto.hash_sh1);
  7    select username
  8    into   v_username
  9    from   myusers
10    where  username = loginuser.username
11    and    password = v_hash;
12    dbms_output.put_line('User: '||v_username||' logged in.');
13  exception
14    when no_data_found then
15      dbms_output.put_line('Username/Password is not valid!');
16  end;
17  /
Procedure created.
SQL> exec loginuser('Fred','Freddy');
Username/Password is not valid!
PL/SQL procedure successfully completed.
SQL> exec loginuser('Fred','Fr3ddy');
User: Fred logged in.
PL/SQL procedure successfully completed.
Ideally you would do the hashing of the password inside the client side application so only the Hashed value goes over the network, but the above demonstrates the principle of using hashes to store passwords.  Because it's a one way algorithm, only a brute force method can be used to try and determine the original password.  There is no way to directly un-hash the value.  To check for a valid login, we don't retrieve the password and try to unhash it to compare against what the user has supplied, we actually take what the user has supplied and hash that in the same way and then compare the hashes.
The point of including the username or some other data in the hashing process means that if two users have the same password, they will still have different hash values, so it won't be apparent they are the same passwords.  In my example, the point of putting another character between the concatenation of username and password is in case the username and password together would give the same result e.g.
If we had one user "Fred" with password "Fr3ddy" then just concatenating the strings would give "FredFr3ddy".
If we had another user "FredF" and he happened to choose a password "r3ddy" then just concatenating those would also give "FredFr3ddy"
by introducing a known breaking character they would be different e.g. "Fred!Fr3ddy" and "FredF!r3ddy" and hence give different hash values.
That's the basics of how passwords are stored for security.
It would take a lot of processing power and brute force methods just to determine a single password for a single user when using hashing methods of security.
With encryption, a brute force method could be used to find the decryption key, and once found that could be used to decrypt ALL the encyrpted data, hence it is less secure, especially when some clever person will no doubt have written the key down somewhere so they don't forget it.  With hashing there's no key to write down. 

Similar Messages

  • How to find encrypted columns in oracle 10g database

    Hi,
    How to find encrypted columns in oracle 10g database? We can see using view dba_encrypted_columns or all_encrypted_columns .
    my question is apart from this is there anyother views or tables?
    Thanks..

    user602872 wrote:
    Hi,
    How to find encrypted columns in oracle 10g database? We can see using view dba_encrypted_columns or all_encrypted_columns .
    my question is apart from this is there anyother views or tables?Hmm not which I could find,
    SQL> select * from dict where lower(table_name) like '%encrypted%';
    TABLE_NAME
    COMMENTS
    DBA_ENCRYPTED_COLUMNS
    Encryption information on columns in the database
    ALL_ENCRYPTED_COLUMNS
    Encryption information on all accessible columns
    USER_ENCRYPTED_COLUMNS
    Encryption information on columns of tables owned by the user
    SQL>HTH
    Aman....

  • PUBLIC database account on oracle 10g - what are the default privilages?

    Hi there,
    I was wondering what are the default privileges to PUBLIC database account on oracle 10g R2. Could somebody explain it? Thank you in advance.

    There is not a user PUBLIC. There cannot be a user PUBLIC. Users and roles share the same name space so if there is a role PUBLIC, there can not be a user PUBLIC.
    The catalog table user$ contains both roles and users. The usage is determined by the TYPE# column - 1 = user, 0 = role.
    select user#, name, type# from user$  order by 1
    sys@esdb01:pncl# /
         USER# NAME                               TYPE#
    ========== ============================== ==========
             0 SYS                                     1
             1 PUBLIC                                  0
             2 CONNECT                                 0
             3 RESOURCE                                0
             4 DBA                                     0
             5 SYSTEM                                  1Try it yourself and see.
    SQL> create role foo;
    Role created.
    SQL> create user foo identified by bar;
    create user foo identified by bar
    ERROR at line 1:
    ORA-01920: user name 'FOO' conflicts with another user or role name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Scripts To Check Database Growth in Oracle 10g

    Hi All,
    I need your help developing a script to find out the database growth in Oracle 10G on daily, weekly and monthly basis.
    In our production database tablespace growth is huge and we are adding data files frequently. Management is asking about the database growth report and I need to present it. Is there any such script which will suffice the purpose.
    My database version is 10.2.0.5.
    Please help.
    Regards,
    Arijit

    1000103 wrote:
    Hi All,
    I need your help developing a script to find out the database growth in Oracle 10G on daily, weekly and monthly basis.
    In our production database tablespace growth is huge and we are adding data files frequently. Management is asking about the database growth report and I need to present it. Is there any such script which will suffice the purpose.
    only the report that you create
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • What is limit of database size in oracle 10g standard edition/edition one

    Hai All,
    What is the limit of database size in oracle 10g standard edition and standard edition one.. I see the white paper of oracle says that the limitation is 500 GB. This limitation is correct.? if correct then what happened after the limit..?
    Please help?
    Shiju

    What white paper would that be? I can't see any limit in the Oracle Database 10g Editions comparisons.
    C.

  • How to Connect to Oracle 9i database server via Oracle 10g XE

    I have installed Oracle 10g eXpress Edition and uninstalled Oracle 9i client database. I used Oracle 9i client to connect to another Database server on a local LAN. Is it possible to create a database link to the old Oracle 9i database server via Oracle 10g XE? If yes, do I need to add ODBC drivers?
    I want to achieve the following:
    1) Create a connection to the Oracle 9i database server using Ora101040 odbc drivers.
    2) Use a similar 9i tool (Enterprise Management Console) within Oracle 10g XE to access Oracle 9i Database tables on a LAN network.
    3) Create data access to Oracle 10g XE via some ODBC connection from a C++ runtime application.
    Hope to receive help from Oracle professionals.
    Thanks.

    I have installed Oracle 10g eXpress Edition and
    uninstalled Oracle 9i client database. I used OraclePlease clarify - you uninstalled the 9i database or the 9i client.
    9i client to connect to another Database server on a
    local LAN. Is it possible to create a database link
    to the old Oracle 9i database server via Oracle 10g
    XE? If yes, do I need to add ODBC drivers?
    Database links between Oracle databases do not require ODBC. They do require Oracle Networking (included with both Oracle9i Database and Oracle Database 10g XE) to be configured correctly.
    It is also possible to connect ot the 9i database using the 10g Instant Client (separate download)
    I want to achieve the following:
    1) Create a connection to the Oracle 9i database
    server using Ora101040 odbc drivers.Please clarify - what client do you wish to run that needs ODBC?
    2) Use a similar 9i tool (Enterprise Management
    Console) within Oracle 10g XE to access Oracle 9i
    Database tables on a LAN network.XE does not have an equivalent to Oracle Enterprise Manager. XE does come with HTMLdb preinstalled and configured, and HTMLdb provides a subset of the administration capabilities of Enterprise Manager.
    3) Create data access to Oracle 10g XE via some ODBC
    connection from a C++ runtime application.You can download ODBC drivers from the same location on OTN you downloaded XE. I do not know whether XE includes ODBC drivers. ODBC drivers will usually still require you to configure the Oracle Networking.
    There are a number of items that make me believe you do not have a good grasp of Oracle architecture and basics. If true, I encoureage you to start reading the Concepts manual found for the database at http://docs.oracle.com, or at least the O'Reilly book 'Oracle Essentials' found at http://oracle.oreilly.com

  • Maximim Number of process and session can set in oracle 10g

    my os is 32 bit windows and ram size is 10gb and i am using AWE_WINDOW_MEMORY setting and now my sga is 6 gb.what would be Maximim Number of process and session can set in oracle 10g database

    mithun wrote:
    my os is 32 bit windows and ram size is 10gb and i am using AWE_WINDOW_MEMORY setting and now my sga is 6 gb.what would be Maximim Number of process and session can set in oracle 10g databaseThe maximum number of sessions is controlled by your database's SESSIONS parameter. This value is most derived from the PROCESSES parameter. You cannot exceed this number of sessions unless you raise the parameter value.
    If your database is configured to handle enough sessions, then Oracle can literally handle thousands of simultaneous connections, provided your database server also has enough resources to handle this number of connections. You will want to implement Oracle's Shared Server connections so that multiple connections share a pool of processes on the database server. This minimizes the resource consumption used by the connections.
    Read the following document as well.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/manproc.htm
    Thanks

  • SAP database cluster for oracle 10g

    Dear Experts,
    Can anybody give me some idea on how do SAP database clustering for oracle 10g on two different remote system.
    Is there any sapnote for this or any other help document. Is it possible to do on two different remote system.
    Please guide me.
    Thanks n regards
    Bhaskar

    Hi Bhaskar,
    do you have SDN account, that allow you to access customer available information in SDN?
    If yes,  please look at the
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0b8cd93-f1e9-2910-c186-86bfff3dac63">MSCS Configuration and Support Information for SAP NetWeaver '04 and 7.0</a>
    On page 20 you will find some helpful information.
    best regards

  • Can we rename the database name in oracle 10g

    Hi,
    Can we rename the database name in oracle 10g.
    Please help

    Yes as already said, using DBNEWID Utility can renamed the database name.
    You can also take a look at the Oracle Metalink Note:429674.1 (Which was written by me) - Subject: How We Used the Oracle DBNEWID Utility to Change the Database Name
    Regards,
    Sabdar Syed.

  • How to genrate and check wait statistics in oracle 10g

    Dear all,
    how to genrate and check WAIT STATISTICS in oracle 10g on RHEL4.
    Regards,
    Ali

    Oracle Kernel keeps track of these statistics. Query v$waitstat for overall system level wait statistics or v$session_wait for individual session wait statistics.

  • Columns in oracle 10g database

    How many maximum columns i can create in a table of oracle 10g database?

    This is the twice today :
    Max.No. of columns a table can have in oracle9i db.10g?
    Why everyone ask the same question ?
    Nicolas.

  • Database links between Oracle 10G and 7.1/7.3 & 8.0 databases

    Hi All..
    Unfortunately one of our customers is still using very very old unsupported versions of the database - 7.1 and 7.3 and 8.0. They wish to start an upgrade process - moving up to 10G (via staged upgrades) but wish to know whether they can still access information from old databases via database links.
    I know that the Oracle 10G client cannot connect to database versions this old, and I am presuming that the database itself cannot via DB links but I thought it wise to check.
    Any help appreciated. Thank you.

    Oracle 10.1 is certified to connect to 8.1.7 and later. Database links to earlier versions are not certified and generally do not work.
    The general solution to this sort of thing tends to be putting an older version of the database (8.1.7 or 9.0.1, usually) between the ancient databases and the new database. 10.1 can create a database link to 9.0.1. 9.0.1 can create a database link to 7.3.4 and create views that reference remote 7.3.4 objects that the 10.1 system can query. Of course, you're taking data over the network twice, so performance isn't ideal, but it can work in a pinch.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Exporting database from oracle 11g and then importing it in oracle 10g

    Hi! there every one...
    please tell me the way to export the data and my data structures i.e the complete database from Oracle 11g to older version(oracle 10g) and how to import it there..
    i'm moving the database from one machine to another without lan, preferably via storage device...

    EXPORT FROM 11G to 10G.
    1) log on to 11G box.
    2) cd /<>/product/app/oracle/product/10.2/network/admin/
    3) Get the connection string from tnsnames.ora for the respective instances
    4) export ORACLE_HOME=/<>/app/oracle/product/10.2.0
    5) export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    6) cd /<>/app/oracle/product/10.2.0/bin
    7) #>./exp file= test.dmp ......
    Username: user1@<connection_string>
    Password:*******
    8) Import as usual

  • Issue while selecting XMLType column in Oracle 10G

    HI All.
         We are trying to get some value from XML Type column and it works fine with Oracle 11g, we are trying the same with Oracle 10g but it fails with below  stack Trace . looking at the stack Trace we feel it is the issue with ODP.net ,
    we have below oracle Versions installed in our Server .
    Oracle Data Access Components    ---  10.2.0.2.21
    Oracle Database 10g Release 2 Patch Set 3  --- 10.2.0.4.0
    Kindly let us know if it is specific to any ODP.net issue, or anyone has some sought of work around to resolve this issue .
    -----------Stack Trace --------------------------------------------------------
    Message: Exception has been thrown by the target of an invocation.
    StackTrace:    at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
       at System.Web.Services.Protocols.WebServiceHandler.Invoke()
       at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
       at System.Web.Services.Protocols.SyncSessionlessHandler.ProcessRequest(HttpContext context)
       at System.Web.Script.Services.ScriptHandlerFactory.HandlerWrapper.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
       at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
       at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
       at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
       at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
       at System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
    InnerException: System.AccessViolationException
    Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    StackTrace:    at Oracle.DataAccess.Types.OpsXmlStream.GetValueBuffer(IntPtr opsConCtx, IntPtr opsErrCtx, IntPtr opsXmlTypeCtx, IntPtr& opsXmlStreamValueBuffer, Int32& numCharsInBuffer)
       at Oracle.DataAccess.Client.OracleDataReader.GetString(Int32 i)
       at Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)
       at Oracle.DataAccess.Client.OracleCommand.ExecuteScalar()
       at ProVation.DataAccess.CProvDatabase.GetScalar(SQLText& sql, Object& returnval, String& user)
       at ProVation.DataAccess.CProvDatabase.GetScalar(SQLText& sql, String& returnval, String defaultvalue, String& user)
       at ProVation.BusinessRules.ConfigsBR.GetDocumentXML(String specialty, Boolean isProvationXML, Boolean isEdit)
       at ProVation.BusinessRules.ConfigsBR.GetTreeXML(String terminal, String site, String speciality, DataSet& ds, DataSet& dsXML)
       at WKOSAWS.GetTreeXML(String terminal, String key, String strSpeciality, String strSite, DataSet& dsSpeciality) in c:\inetpub\wwwroot\WKOSAWS\App_Code\WKOSAWS.cs:line 207
    Thanks in Advance
    Suren

    Thanks Alex .
    We will try to Install ODP.NET 11.2 Release 5 and proceed further .
    Thanks,
    Suren

  • Executing Procedure in SQL SERVER and Storing the results in Oracle 10g

    Hello,
    I am trying execute SQL SERVER procedure from Oracle 10g and store the results in a oracle table. When I tried executing the procedure i am getting errors.
    I am using Oracle Heteroeneous Services.
    Steps I followed.
    1. Created ODBC DSN on Oracle Server connecting to SQL SERVER database.
    2. Created Listner entry and TNSNAMES entries.
    3. Created Database link and able to select the data from the SQL SERVER tables.
    Here is the code i tried to execute the procedure.
    BEGIN
    "META"."extract"@abc;
    END;
    "META"."extract"@abc;
    ERROR at line 2:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'META.extract@ABC' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    Please help me.
    Thank You,
    Seshadri Thope

    Hi thopevs,
    Can you please tell me the right syntax of calling procedures(on sql server) from oracle?
    I am getting following error:
    SQL> execute "GetdateSys"@oratosql;
    begin "GetdateSys"@oratosql; end;
    ORA-06550: line 2, column 7:
    PLS-00201: identifier 'GetdateSys@ORATOSQL' must be declared
    ORA-06550: line 2, column 7:
    PL/SQL: Statement ignored
    SQL>
    Your help will be highly appreciated.
    Thanks & Regards,
    M.U.N.A

Maybe you are looking for