Encrypted key store in mssql , get it back when validation part

i ned to make sure, do i do the rigth way to encrypt the password, how to cal it out and compare with the password that user key in jsp. i ned to store it in mssql, is it enough length to save the password after the encryption, please correct me if anything wrong. sory i still a beginer in servlet and jsp.
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.myorg.SystemUnavailableException;
import sun.misc.BASE64Encoder;
import sun.misc.CharacterEncoder;
public final class PasswordService
  private static PasswordService instance;
  private PasswordService()
  private String getPasswordEcrytionKey(){
     Propertise Props = new Propertise();
     try {
          fileUtilities fileManager = new FileUtilities();
          file ProFile = fileManager.searchFilePath("encrytionkey.propertise");
     if ( prosFile == null)
          System.out.println("encrytionkey.propertise did not found in System CLASSPATH.");
     else
     props.load(new FileInputStream(prosFile));
     encrytionKey = props.getProperty("encrytion Key");
     plaintext = props.getProperty("Plain Text format");
     catch (IOException e)
          System.out.printil("Error Trance in ConnectionUtilities.getConnectionUrl() : +           e.getmessage())     
     e.printStackTrace();
     return "encrytionKey" + encrytionKey + "Plain Text Format" + plaintext;
  public synchronized String encrypt(String plaintext) throws SystemUnavailableException
    MessageDigest md = null;
    try
      md = MessageDigest.getInstance(EncrytionKey);     
    catch(NoSuchAlgorithmException e)
      throw new SystemUnavailableException(e.getMessage());
    try
      md.update(plaintext.getBytes(plaintext));      
    catch(UnsupportedEncodingException e)
      throw new SystemUnavailableException(e.getMessage());
    byte raw[] = md.digest();     
    String hash = (new BASE64Encoder()).encode(raw);      
    return hash;
  public static synchronized PasswordService getInstance()      
    if(instance == null)
      return new PasswordService();
    else   
      return instance;
# This propertise file is storing the password encrytion key
# which is by the CS to encrytion the password to access the CS system
# passwordEncrytionkey.class will access this file to retrive value.
# Below is the pair of key = value
# IMPORTANT: DO NOT DELETE or RENAME the key. You can only change
# the value.
Encrytion key = MD5
Plain Text format = UTF-8thx in advance

i ned to make sure, do i do the rigth way to encrypt the password, how to cal it out and compare with the password that user key in jsp. i ned to store it in mssql, is it enough length to save the password after the encryption, please correct me if anything wrong. sory i still a beginer in servlet and jsp.
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.myorg.SystemUnavailableException;
import sun.misc.BASE64Encoder;
import sun.misc.CharacterEncoder;
public final class PasswordService
  private static PasswordService instance;
  private PasswordService()
  private String getPasswordEcrytionKey(){
     Propertise Props = new Propertise();
     try {
          fileUtilities fileManager = new FileUtilities();
          file ProFile = fileManager.searchFilePath("encrytionkey.propertise");
     if ( prosFile == null)
          System.out.println("encrytionkey.propertise did not found in System CLASSPATH.");
     else
     props.load(new FileInputStream(prosFile));
     encrytionKey = props.getProperty("encrytion Key");
     plaintext = props.getProperty("Plain Text format");
     catch (IOException e)
          System.out.printil("Error Trance in ConnectionUtilities.getConnectionUrl() : +           e.getmessage())     
     e.printStackTrace();
     return "encrytionKey" + encrytionKey + "Plain Text Format" + plaintext;
  public synchronized String encrypt(String plaintext) throws SystemUnavailableException
    MessageDigest md = null;
    try
      md = MessageDigest.getInstance(EncrytionKey);     
    catch(NoSuchAlgorithmException e)
      throw new SystemUnavailableException(e.getMessage());
    try
      md.update(plaintext.getBytes(plaintext));      
    catch(UnsupportedEncodingException e)
      throw new SystemUnavailableException(e.getMessage());
    byte raw[] = md.digest();     
    String hash = (new BASE64Encoder()).encode(raw);      
    return hash;
  public static synchronized PasswordService getInstance()      
    if(instance == null)
      return new PasswordService();
    else   
      return instance;
# This propertise file is storing the password encrytion key
# which is by the CS to encrytion the password to access the CS system
# passwordEncrytionkey.class will access this file to retrive value.
# Below is the pair of key = value
# IMPORTANT: DO NOT DELETE or RENAME the key. You can only change
# the value.
Encrytion key = MD5
Plain Text format = UTF-8thx in advance

Similar Messages

  • When I try to open a Pages document from iCloud, created on my iPad, I get message stating I need a newer version of Pages.  When I go to app store all I get is "installed" when looking at pages app. my Macbook pro is up to date with all updates.

    When I try to open a Pages document from iCloud, created on my iPad, I get message stating I need a newer version of Pages.  When I go to app store all I get is "installed" when looking at pages app. my Macbook pro is up to date with all updates. Any ideas?

    You have 2 versions of Pages on your Mac.
    Pages 5 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5/5.01 can not open Pages 5.1 files and you will get the warning that you need a newer version.
    Pages 5.1 sometimes can not open its own files and you will get the warning that you need a newer version.
    Pages 5 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has not only managed to confuse all its users, but also itself.
    Note: Apple has removed over 100 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Archive/trash Pages 5, after exporting all Pages 5 files to Pages '09 or Word .docx, and rate/review it in the App Store, then get back to work.
    Peter

  • How do I get iTunes back when I get the error message ; the application "I Tunes" unexpectedly quit while trying to restore it's windows. Do you want to restore it's windows?

    how do I get ITunes back when I get the error message :
    The application "ITunes" unexpectedly quit while trying to restore it's windows.  Do you want to restore it's windows?
    I already tried reloading ITunes and it still doesn't startup.

    You didn't mention but are you still running a version of iPhoto older than iPhoto 11?
    If yes, then go to the App Store and purchase the iP 11 app and install it. Back up your photo library first.
    Once iP 11 is installed and has imported all your photos do a restart of the Mac.
    This should resolve most issues with iTunes 10.6 and you should be able to run iTunes and sync up your iOS devices.

  • Had a windows computer with my element 7.  Now just bought a Mac OSX   version 10.9.2 what would be the best photoshop elements for this machine.  I did download elements 12 from Apple store but kept getting incompatible message when trying to open a phot

    I thought elements were simple but maybe it is just me.  Having problems moving photos from iphoto to elements

    Duplicate post; see:
    had a windows computer with my element 7.  Now just bought a Mac OSX   version 10.9.2 what would be the best photoshop elements for this machine.  I did download elements 12 from Apple store but kept getting incompatible message when trying to open a phot

  • I want to delete a few contacts, apps, pics etc from my iphone, but when I delete and connect to my laptop they sync and come back again. How can I delete those items and not get them back when I connect my iphone to my laptop?

    I want to delete a few contacts, apps, pics etc from my iphone, but when I delete and connect to my laptop they sync and come back again. How can I delete those items and not get them back when I connect my iphone to my laptop?
    Also where exactly on the laptop is teh data stored.
    Thank you!!

    go to 'Edit' in the menu bar. Then choose 'Preferences'.
    you'll see a pop-up and there's a tab called 'Devices' there. If you click that, you will be able to check a box that says 'prevent automatic syncing for iPods, iPads and iPhones' or something like that.
    Hope this helps
    NB: if you don't even see the menu bar that has options like 'File, Edit, View, etc', first click the black/white square button on the top left of your screen, and then click 'show menu bar'. It should pop right up.
    Good luck

  • I cannot see my Iphone 4 in my device window in the finder anymore.  It use to appear so I could copy the camera pictures off of it and transfer them to other folders.  Does anyone have and idea how to get it back when you plug it in initially.  Thanks

    I cannot see my Iphone 4 in my device window in the finder anymore.  It use to appear so I could copy the camera pictures off of it and transfer them to other folders.  Does anyone have and idea how to get it back when you plug it in initially.  Thanks

    You will want to open iPhoto, go to the iPhoto menu and select Preferences. Under the General tab, next to Connecting camera opens: select iPhoto. Close the preferences and quit iPhoto. Reconnect your iPhone 4. iPhoto should open automatically and offer to import your pictures. Import them and then do what you want with them.
    Best of luck.

  • I would like to buy my boyfriend the iphone 5. He has an upgrade - but can I purchase it for Christmas now and get money back when he activates and uses his upgrade?

    I would like to buy my boyfriend the iphone 5. He has an upgrade - but can I purchase it for Christmas now and get money back when he activates and uses his upgrade?

    Or purchase an Apple Gift Card for him to use to get a phone at Apple after Christmas. He gets the card as the Christmas gift and can go get the phone himself. It would cost you the same amount of money.

  • I Lost my iphone how can i get it back when i havent turn on find my iphone i have already log in icloud and still have account and password

    I Lost my iphone how can i get it back when i havent turn on find my iphone i have already log in icloud and still have account and password

    Contact your carrier and the police. If it was lost in a specific building, ask the people running it.
    (124410)

  • I removed the ENTER key and can't get it back on

    Hi,
    Approximately 2 months ago i removed a few keys off my Macbook Pro to clean them. I managed to replace all of them except for the ENTER key.
    Underneath the casing there are 2 plastic bases which scissor. These bases attach via hooks on the main keyboard. I managed to get one back on but i can't get the other base back on. The enter key itself still works but without the housing on top.
    Went i went to the genius bar i was told because t was out of warranty they would charge me or if i went back to the retailer (Tesco) they would fix it within the 6 year european consumer law. The genius said that he could see it had not been mistreated and it shouldn't be a problem. When i consequently called Tesco they told me they wouldn't as it was user damage and that i should go back to Apple because when Tesco arrange repairs they get Apple to do them anyway.
    Im a little tired of heading backward and forward between the two companies and no one is helping. I just want my key back on.
    I have a mid 2012 Macbook Pro. i5 Processor, 4GB Ram, 500GB HDD.

    Make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: command+Shift+F).<br />
    If you are in full screen mode then hover the mouse to the top to make the Navigation Toolbar and Tab bar appear.<br />
    You can click the Maximize button at the top right to leave full screen mode or right click empty space on a toolbar and use "Exit Full Screen Mode" or press F11.<br />
    *http://kb.mozillazine.org/Toolbar_customization
    *https://support.mozilla.com/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • I lost my osx lion from app store how to get it back please help

    I purchaced OSX Lion and i click the x button and I'm not able to download it again.
    can you help me how to get it back?

    You have to unhide Lion > http://support.apple.com/kb/HT4928?viewlocale=en_US&locale=en_US Finally, you will be able to download OS X Lion

  • The server lost all my sync data after new OS install (I know my pass & key); How do I get it back?

    Hello,
    Ive been using sync on both my laptop and desktop in windows 7 and linux mint. Its been working great cross platform, but I recently formatted my drives and reinstalled everything. I obviously didn't save the Firefox passwords because I trusted the sync server to have it all. After a fresh OS install, I installed the latest ver of Firefox, logged in to my sync account and selected the default option for sync (both ways) knowing that the server has all my data and will download it onto my newly installed Firefox.
    Unfortunately the server doesn't seem to have my data anymore as it didn't download any passwords I had saved and sync since before the full format/installation process.
    How do I get it back now? Does the server has a roll back function?
    Thank you
    Ovi

    Thank you again for your kind and prompt reply.  I really appreciate it.  I think the fact that I am transferring stuff from my old desktop PC to a new laptop has saved me.  I copied all the apps from iTunes on the old desktop to a flashdrive, then added those apps (via Explorer!) into iTunes Media.  Then I synched the phone.  I have got all but 45 apps back, including the data!!! How awesome is that!  It's 9.50 pm here in Australia and I have been sat in front of all this technology for about 15 hours now, so I'm giving up for the night.  Perhaps tomorrow, somehow the lost 45 apps will magically appear. I haven't quite worked out which ones I'm missing as I'm so tired.
    I want to thank you most sincerely though for taking the time to reply to me.  You are wonderful.   
    Please, Heavenly Technology God, let this all work in the morning.

  • How do I get money back when a purchase you made is unplayable on your device

    How do you get money back that you spent on a purchase but the item is unplayable on your device

    If you are looking for a refund for the purchase of this application, you must request this from the support web site for the itunes or app's store.   You should note that officially the iTunes Store does not give refunds and that the terms of sale state that "all sales are final". You can ask, though, and perhaps they'll make an exception for you.  Just state why you feel a refund is deserved.
    iTunes Store - http://www.apple.com/support/itunes/contact/ - follow the onscreen instructions
    App's Store - http://www.apple.com/support/mac/app-store/contact/ - follow the onscreen instructions

  • When I updated to IOS5 I lost two in game app purchases (the mighty eagle), how do I get those back, when I updated to IOS5 I lost two in game app purchases (the mighty eagle), how do I get those back

    when I updated to IOS5 I lost two in game app purchases (the mighty eagle for angry birds and angry birds seasons), how do I get those back? They are not in my app purchased list in Itunes. 

    Contact iTunes Store support staff through the report a problem links in your account history or,
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html > Get iTunes support via Express Lane > iTunes > iTunes Store

  • Prefer older grid view of itunes store - can i get it back?

    after resisting for a couple of years, i updated my version of the itunes store to itunes9. in the process, i lost the no-nonsense grid view listing of tracks for purchase, including the ability to click-and-drag to re-size columns when not all the info is visible. predictably, the 'new' store view is laden with album art graphics, and seems designed to launch new windows favouring album purchases at every step. however, the main problem is: it loads and navigates SO slowly and clunkily for me, it's driving me nuts. any way to get back to the old grid view?

    Sadly, no. I don't like the new store layout, either, for reasons you mention, and others.
    Such as, not really being able to sort by release date.
    Clicking on the Artist name, followed by "See All", now gives items that aren't even remotely associated with that artist.
    You can send feedback to apple:
    itunes menu > help > provide itunes feedback

  • Trying to buy from itunes store and keep getting pushed back to sign in screen

    I'm a long-time itunes user, but yesterday I went to buy a new video and update some apps, and the program keeps pushing me back to the signin screen, asking for credit card security, etc.  When I finish, I get the same login screen.  I've sent please to Apple and get nothing but standard reply of "we're working on it."  Has anyone else had this problem and, if so, were you able to fix it yourself?  if so, please advise.

    We are using wireless...guess it's 3G. Are not having internet problems, synced with the computer even. Can't seem to get anything with iTunes even though we are signed in.

Maybe you are looking for

  • LabVIEW 8.2 classes do not work in LV 8.5?

    I just switched to LabView 8.5 to take advantage of the new features in the Project Explorer. Unfortunately the conversion of my project from 8.2 to 8.5 seems to have completely destroyed all of my LVOOP classes in the project. Everthing was working

  • Problem with quick mask selection appearence

    Hi, I am having a problem with the quick mask view (red) selection. When i press the \ key to see the selection i get a red rectangle in a random place of the screen instead of the red selection. Before the last update i had no such problem. Any solu

  • Output price variance calculation

    Hello, I have a question on output price variance calculation in SAP. The help reads: "Output price variances are reported in the following situations: If the standard price has changed between the time point of delivery to stock and the time point w

  • InDesign reverting back to basic colour scheme after crash

    I am new at this software, how do I get my orignal colours on my design back - also the printers come up with different colours

  • CANNOT CREATE FILE ?   DOWNLOADING

    I let a friend borrow my computer and i think he changed some stuff on it. Now everytime i try to download andything in the downloads screen it says "cannot create file" and doenst download the file. Anyone have any ideas?