Password encrpytion for security

Hi
I am using the below code to encrpyt and decrpyt my password.
Could you please let me know how to use the hash algotithm here to protect password more secure?
Abd also please let me know how to keep safe the key?
Thanks
DECLARE
   input_string       VARCHAR2 (200) :=  'Secret';
   output_string      VARCHAR2 (200);
   encrypted_raw      RAW (2000);             -- stores encrypted binary text
   decrypted_raw      RAW (2000);             -- stores decrypted binary text
   num_key_bytes      NUMBER := 256/8;        -- key length 256 bits (32 bytes)
   key_bytes_raw      RAW (32);               -- stores 256-bit encryption key
   encryption_type    PLS_INTEGER :=          -- total encryption type
                            DBMS_CRYPTO.ENCRYPT_AES256
                          + DBMS_CRYPTO.CHAIN_CBC
                          + DBMS_CRYPTO.PAD_PKCS5;
BEGIN
   DBMS_OUTPUT.PUT_LINE ( 'Original string: ' || input_string);
   key_bytes_raw := DBMS_CRYPTO.RANDOMBYTES (num_key_bytes);
   encrypted_raw := DBMS_CRYPTO.ENCRYPT
         src => UTL_I18N.STRING_TO_RAW (input_string,  'AL32UTF8'),
         typ => encryption_type,
         key => key_bytes_raw
    -- The encrypted value "encrypted_raw" can be used here
DBMS_OUTPUT.PUT_LINE ( 'key_bytes_raw: ' || key_bytes_raw);
DBMS_OUTPUT.PUT_LINE ( 'encryption_type: ' || encryption_type);
DBMS_OUTPUT.PUT_LINE ( 'encrypted_raw: ' || encrypted_raw);
   decrypted_raw := DBMS_CRYPTO.DECRYPT
         src => encrypted_raw,
         typ => encryption_type,
         key => key_bytes_raw
   DBMS_OUTPUT.PUT_LINE ( 'decrypted_raw: ' || decrypted_raw);
   output_string := UTL_I18N.RAW_TO_CHAR (decrypted_raw, 'AL32UTF8');
   DBMS_OUTPUT.PUT_LINE ('Decrypted string: ' || output_string);
END;Edited by: user212310 on Feb 4, 2011 12:46 AM

Wow that is really overkill unless it is important for you to be able to fetch the password back in plain text.
Like others have said most times you store the users password as a hash. When they come back, you hash whatever they give you as a password then compare the two hashes.
When considering encryption one has to decide on strength. In other words how long would it take to decrypt a string without knowing its key.
What is the data you are protecting worth? Are you just trying to keep your average hacker out or are you defending against dedicated break in attempts?
One of the simplest solutions to defeat a dedicated break in attempt is to simply put a "three strikes" and you out rule in place so the account is locked after 3 attempts with an incorrect password. Or you can simply limit the number of attempts in a given amount of time, or after three attempts you lock the account for n minutes.
There are lots of simple cyphers that can be implemented as a stored procedure that would do exactly what you want. The complex the cypher the harder it is to implement.
As to your code. It works fine on my system in pl/sql and I am on Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 linux client and server.
As to keeping your encryption key safe you can hide it in any number of tables call the column just about anything, so use your imagination.
I think your question has been answered.

Similar Messages

  • Password changed for security purposes

    Hello,
    My password has been changed for security purposes...however the email address that is linked to my account has been deleted (college account). They only way i can access my new changed password is for it being sent through email. How can i change the email address if i cant get into my account to change it? Make sense?
    Any help would be appreciated!
    Thanks,
    Lauren

        Hello Lauren,
    I know how important it is to be able to unlock your device with the correct password.  I want to ensure you’re able to do this.
    Have been able to retrieve or reset your password?  If not, I’d like to provide you a link with support for Apple ID here:  http://bit.ly/aQs8MT  Let us know how this works out for you.
    Thanks,
    AnthonyTa_VZW
    VZW Support
    Follow us on Twitter @VZWSupport

  • How can i change email address for security questions and password resets

    I've noticed that my password reset requests are going to an old email acount. In fact, i am not sure where they are going.
    the real issue is that i don't see a way to change it when i am logged in (it took me many tries to actually log back in) to my apple id account.
    I've changed alternate email accounts, but again i don't see a way to change my destination email account for security section of the account.
    Also i would rather reset these via text (ATT has this option for my cell phone account reset and i love it).  I don't see an option like that from Apple at all.
    Any suggestions and help will be much appreciated. Don't want to struggle with password resets every time i need to get in.

    If you're able to supply two of your security answers, click here and follow the instructions to change your rescue email address.
    If not, you need to contact Apple.
    (125051)

  • When trying to update my apps on my phone, after logging in it says my account has been disabled for security reasons. I've updated my password but it still says its disabled. Any thoughts?!

    When trying to update my apps on my phone, after logging in it says my account has been disabled for security reasons. I've updated my password but it still says its disabled. Any thoughts?!

    Hi,
    If you have followed everything in the link below, and still have the problem, click on one of the links at the very bottom under "Additional Information". That's all we can do for you here:
    http://support.apple.com/kb/TS2446
    Cheers,
    GB

  • I can't change my apple id password because my security answers don't match. It won't give me any other options and just keeps asking for the answers. What do I do?

    I can't change my apple id password because my security answers don't match. It won't give me any other options and just keeps asking for the answers. What do I do?

    Contact the Apple ID Security site from http://support.apple.com/kb/HT5699 or call the AppleCare support number from http://support.apple.com/kb/HE57 and ask to speak with the Account security Team.

  • Dear , please help me to solve my problem in activating my iPhone Where I lost it since 3 months and when found it cannot activating my ID Where give me (Your Apple ID has been disabled for security reasons. To enable your account, reset your password at

    Dear , please help me to solve my problem in activating my iPhone
    Where I lost it since 3 months and when found it cannot activating my ID
    Where give me (Your Apple ID has been disabled for security reasons. To enable your account, reset your password at applied.apple.com)
    And try to reset my password but cannot please help me where am a poor man and cannot pay another money to solving this problem to any one
    My iPhone data
    Ime:  ****
    Model: A1332
    FCC  ID : BCG-E2380A
    IC: 579C-E2380A
    MY id at cloud   ****
    Password    ( ****)
    My country : Egypt
    MY EMAIL : ****
    Tell no: ****
    <Personal Information Edited By Host>

    The following may help:
    Apple ID: 'This Apple ID has been disabled for security reasons' alert appears - Apple Support
    If you didn't receive your Apple ID verification or reset email - Apple Support

  • I have updated my 4S i phone with ios 8.1.2, while activating i forgot my password, i am able to sign in my apple id in pc but not not able to sign in my i phone and  message- your apple id has been disable for security reasons please help

    I have updated my 4S i phone with ios 8.1.2, while activating my iphone, i forgot my password. I am able to sign in my apple id in pc (manage my account) but not not able to sign in my i phone and  message- your apple id has been disable for security reasons please help.
    my apple id is with extension @ gmail.com but for activation it is mentioned that it is linked with extension of @me.com

    Hi ulhas1frombanihal,
    Welcome to the Support Communities!  Because your account has been disabled, you will need to contact Apple ID account security to straighten this out.
    Contact Apple for help with Apple ID account security - Apple Support
    http://support.apple.com/en-us/HT5699
    I hope this information helps ....
    - Judy

  • My 5-minute-old AppleId account was disabled immediately for security reasons. I have followed instructions carefully and although I seem to be able to change my password, I cannot login using the new password bcs account disabled for security reasons!

    It is probably something to do with the fact that I am in the Philippines, but what am I supposed to do? According to the support options I have to pay to open a support ticket. My account was not verified when it was disabled and I think I might be in some sort of deadlock in which the password reset won't work because I'm not verified, and the verification won't work because I can't log in.
    I've never bought a single Apple product before and this has got to be the worst intro I could have imagined!

    Solved.
    After about an hour on the phone with US support (who were very helpful I must say) it turns out that if you do not have an iTunes account with credit card information and a billing address, you are very much more likely to get your AppleId account disabled "for security reasons". This begs the question of course as to whose security we are talking about here! But there you go. If you are an Apple first-timer, get an iTunes account, fill in all your details, and you should be alright.
    Thanks for everyone's suggestions.

  • I forgot my iCloud password and now i can't change it , because my Apple ID has been disabled for security reasons .. so what could i do now ??

    Today i tried to download one application ande when i typed my apple id pasword somthig was wrong "Your account is disabled. This Apple ID has been disabled for security reasons . Tap reset to reset our account. "  When i tried to reset my accout there was this messege that my password wasn't correcr . But there was no way .. i'm sure that this was my password . So i made a new Apple id but now there is another problem  i can't change my iCloud id because i forgot my old password and there is this application "Find my iphone " which i can't delete .. so what could i do ??

    Hi 25091996,
    Thanks for visiting Apple Support Communities.
    If your Apple ID is disabled for security reasons, try resetting your password via the web using the steps in this article:
    Apple ID: 'This Apple ID has been disabled for security reasons' alert appears
    http://support.apple.com/kb/ts2446
    You may not be able to change your iCloud email address, but once your password is reset you can remove your iPhone from Find My iPhone using the steps in this article:
    iCloud: Remove your device from Find My iPhone
    http://support.apple.com/kb/ph2702
    If you're not sure why your Apple ID was disabled, you may want to contact Apple support for more information:
    Apple ID: Contacting Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699
    Best Regards,
    Jeremy

  • I forgot my apple id password and i already deleted my yahoo account for that apple id. When i try resetting it for security question, my birthday verification says invalid. How can i retrieve my password for a swleted yahoo account?

    I forgot my apple id password and i already deleted my yahoo account for that apple id. When i try resetting it for security question, my birthday verification says invalid. How can i retrieve my password for a swleted yahoo account?

    http://support.apple.com/kb/ht5312
    Note: The option to send an email to reset your security questions and answers will not be available if a rescue email address is not provided. You will need to contact iTunes Store support in order to do so. 

  • PSS: Password Self Service: No "Admin Defined Questions" available for security question registration

    Dear Experts,
    I have configured PSS as below,
    Activated "PSS" in connector configuration.
    Configure PSS as per SAP note.
    Configured 2 Questions and activated them.
    Maintained "Service User" in 10 services mentioned in SAP note
    After this when I try to register new user with "Admin Defined Questions" I do not get any question to select, it comes as a blank field. But I can register with user defined questions and can reset password as well as get mail for the same too.
    Questions:
    How to deactivate "User Defined Questions" option?
    Why I am not getting "Admin Defined Questions" for security question registration?
    Did anybody faced the same issue?
    Thanks in advance,
    BR,
    Mangesh

    Hi Friends,
    Any advice on the same.
    I have three issues for PSS,
    Admin question are not visible
    set option "Challenge response"
    Set admin questions and marked them active
    No system displayed during password reset
    Marked connector as PSS activated
    User available in backend as this is allow me to login for users available in backend system through end user logon page
    GRACUSER and GRACUSRCONN has the entry
    How to deactivate option "user defined question" for all users
    Any suggestions. I have tried options suggested on community through threads but no luck till.
    Raised it to SAP now but if anyone can suggest would be great so I would try it.
    BR,
    Mangesh

  • Apple ID has been disabled for security reasons.  I reset password and it still says this.

    Has anyone got advice on apple tv connection.  Apple account disabled for security reasons.  It said to reset account but all I was able to do was reset password which I did.

    Contact itunes support

  • HT201487 iCloud password has been Disable for security reason..

    Please help me... I did try to go Apple ID reset.. I forgot security question and birthday to change new password... Right now my iPad say iCloud password is Disable for security reason.. Please help me to find my old password and security question

    Apple ID- "This Apple ID has been disabled for security reasons" alert appears
    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a rescue email address or a Security Questions issue, then see:
             If you forgot the answers to your Apple ID security questions - Apple Support.
             Manage your Apple ID primary, rescue, alternate, and notification email addresses - Apple Support
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
         4. Account security issues almost always require you to speak directly to an
             Apple representative to securely establish your identity as the account holder.
             You can set it up so that Apple calls you, either immediately or at a time
             convenient to you.
                1. Go to www.apple.com/support.
                2. Choose Contact Support and click Contact Us.
                3. Choose Other Apple ID Topics and choose the appropriate topic for
                    your issue.
                4. Follow the onscreen instructions.
             Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                            Apple ID- All about Apple ID security questions.

  • Why does screen saver prompt for secure disk image password?

    Okay, seems like an odd problem, but here it goes.
    I go into System Preferences->Dektop & Screen Saver.  As the program "loads" availabe image sources and such I get a pop-up requesting a password to my secure disk image.
    Yes, I have a secure disk image in my home directory.
    Yes, the secure disk image is currently "locked" (Not mounted in finder).
    I click cancel (a few times, probably 2 maybe 3 times) and things continue along fine.
    I select a photo source that I want for a screen save and exit peferences.
    I then go an start the screen saver (I'm using Hot-Corners).
    I get the message "Looking for pictures....." for , well...basically forever...
    Sure enough I touch the mouse to leave my screen saver and there is the pop-up again.  Asking for me to unlock my secure
    disk image.
    I thought this might be related to Spotlight.  I tried reading several threads and have gone as far as taking my entire hard-drive/volume
    and putting it into the "Privacy" tab under spotlight.
    Anybody have any idea on what is going on and how I might get it so the "Desktop & Screen Saver" stop prompting me to unlock my
    secure disk image?  (WITHOUT having to make sure the disk image is unlocked before I sleep my screen or open the screen saver utlity)
    As always, I am only speculating that this is Spotlight related so that could be a red-herring....
    thanks in advance.
    OSX:10.7.3
    imac/3.1G/Intel

    Update: i made some progress on this issue.  I found that in the ~/picture/iPhot Library/Database/ directory
    there is a file called Library.apdb.  This file has an entry for the secure disk image i have/had.  I moved the file
    to Libraryapdb.bkup and sure enough, my picture problem went away.  The screen aaver panel no longer prompts
    me to unlock my secure disk image.
    So now the next chapter of my problem;when i open up iPhoto it wants to rebuild my photo library(which makes
    sense and is what i want to haopen) so i allow it.  After about 25 mins it has rebuilt the iPhoto library, but there is
    one problem.  The secure diskimage reference is back in the Library.apdb file that has been recreated!
    So now i need to figure outnhow to get iPhoto to remove anynreference to a phot library i once had on the secure
    disk image but have long since removed.
    I first created an iPhoto library on my secure disk image by holding the option key and invoking iPhoto.
    I removed that library awhile ago....
    So how do i make iPhoto remove a no longer used iPhoto library?

  • HT5312 I forgot the security questions and also the password for security info email of my apple id. Now I want to change the security info email with another. What Should I do?

    I forgot the security questions and also the password (and even account id, sequrity questions,... becouse I didn't use for a long time) for security info email of my apple id. Now I want to change the security info email with another. What Should I do?

    Even if I'm not despertate, creating a new Id is good Idia. But I think I must create another email address also since I can't use the first email adress as an apple id for the new one. That means I should check everyday the new email address also, that is making life complex. Better to try the 1st solution. Thank you very much.

Maybe you are looking for