Can we generate the same key with the same password???

Hi everyone,
Is it at all possible to generate the same key? I have a program that takes a user password, creates a key. And this is done in a loop for 5 times. I just wanted to see if the keys that are generated will be the same for the same password. But the keys that are generated are different.
Does anyone have any idea why this would happen?
My Environment
jdk1.2.2
jce1.2.1
My class is very simple as is as follows
import java.security.*;
public class SecureStuff {
static
Security.addProvider(new com.sun.crypto.provider.SunJCE());
public SecureStuff()
try {
Key secretKey = null;
for (int i = 0; i < 6; i++){
javax.crypto.spec.DESedeKeySpec spec = new javax.crypto.spec.DESedeKeySpec("PASSWORDPASSWORDPASSWORD".getBytes());
javax.crypto.SecretKeyFactory desFactory = javax.crypto.SecretKeyFactory.getInstance("DESede");
secretKey = desFactory.generateSecret(spec);
System.out.println("key generated:"+secretKey.getEncoded());
} catch (Exception e){
e.printStackTrace();
public static void main(String[] args) {
SecureStuff securestuff = new SecureStuff();
The Output
C:\> java SecureStuff
key generated:[B@eb7989c5
key generated:[B@e96189c5
key generated:[B@e99589c5
key generated:[B@e8d989c5
key generated:[B@ef4189c5
key generated:[B@eff589c5
Please can anyone help me..
Thank you very very much.
...geetha

Hi,
I was wondering if you have found a solution to your question.. I justed started working with JCE and have to implement the same functionality. basically I am trying to Encrypt passwords stored in the DB and then when a user logs in, I encrypt his password and compare with the stored password in the DB. For me to do this I have to be sure I can get the same key generated for each encryption.
Also, do you have any examples I can look at or any recommendation on books that explain this subject (JCE) well.
Thanks
Chi

Similar Messages

  • When i press the i key with the shift key nothing happens. I can get a capital i only by pressing the cap lock key whats wrong.

    When i press the i key with the shift key nothing happens. the only way I can get a capital i is by using the caps lock key what is going on. Also from time to time my mouse acts like someone is sitting on it. this stops when i press the command key. i am using the lateist wireless mouse and keypad.

    does it only happen with the i key?
    if it doesnt then try presing shift first then i (or any key) second instead of at the same time.
    if it only happens with the i key then what i would do is take the keyboard and mouse to an apple store and ask them if they will hook it up on their computer to see if it is the keyboard or computer.

  • My acrobat continually asks me to activate it. I go online but it fails each time trying to activate I entered the licence key with the disk but it still says 30 days only

    I am told this is a problem with the Acrobat 7 and there was another site with a new activation code that stops this but I am unable to find it perhaps someone could help with this issue.

    Hello davida64000854,
    Could you please tell me the version of OS on which you are trying to activate Acrobat 7.
    Also, please share the screenshot of the error message that prompts on your screen.
    You might also refer the following KB doc link mentioned below:
    Error: "Activation Server Unavailable" | CS2, Acrobat 7, Audition 3
    Let me know if this helps.
    Regards,
    Anubha

  • Creating a primary key with the parallel option and the tablespace option

    I know I can create a unique index with these options and then make the primary key with the "using index" clause. anyway to do this and skip the create unique index and just create the primary key ?

    SQL> ALTER TABLE t
      2  ADD CONSTRAINT pk_t
      3  PRIMARY KEY (testcol)
      4  USING INDEX
      5  TABLESPACE example
      6  PARALLEL (DEGREE 2);
    PARALLEL (DEGREE 2)
    ERROR at line 6:
    ORA-03001: unimplemented featureYou can name the tablespace but you must do an alter index thereafter.

  • When I use the Alt key and the clone tool, I get a message that I did not use the Alt key to define

    Whe I use the Alt key with the clone tool, I get a message that I have to use the Alt key to define the area to be copied. What am I doing wrong?

    I tried to check the alined box, but it would not work. I was able to check
    the Sample box, but they they give you about 5 choices to check and I have
    no  idea what they are all about. I appreciate your help.
    Dino
    In a message dated 9/18/2012 11:09:06 A.M. Eastern Daylight Time, 
    [email protected] writes:
    Re:  When I use the Alt key and the clone tool, I get a message that I did 
    not use the Alt key to define
    created by hatstead (http://forums.adobe.com/people/hatstead)  in 
    Photoshop Elements - View the full  discussion
    (http://forums.adobe.com/message/4707426#4707426)

  • Query 0: Runtime error There is already a line with the same key. with para

    Dear all,
    I have a query with several variables. One of the variables is Version. When I use certain values e.g. 1,2 or 3, I can generate the query without any problem. However, when I use the other values e,g, 4, 5, or 6, the query gives me with the following error messages :
    1. Query 0: Runtime error There is already a line with the same key. with parallel processing via RFC
    2. Error while reading data; navigation is possible
    3. >> Row: 174 Inc: LRSDRPU02 Prog: SAPLRSDRP
    Error 1
    Query 0: Runtime error There is already a line with the same key. with parallel processing via RFC
    Message no. DBMAN428
    Error 2
    Error while reading data; navigation is possible
    Message no. BRAIN289
    Diagnosis
    An error occurred while reading the data. The query result is therefore empty or inconsistent and is not buffered in the OLAP cache.
    Procedure
    You can continue to navigate or return to the last navigation step.
    Error 3
    >> Row: 174 Inc: LRSDRPU02 Prog: SAPLRSDRP
    Message no. RS_EXCEPTION301
    Diagnosis
    En error has been triggered. This message specifies where in the coding the error occurred. This helps you to localize the error quickly.
    May I know what causes this error and how to troubleshoot it?
    Thank you.

    Venkat,
    You are either a genius or working for SAP.
    In any case, your solution solved my problem.
    Thanks heaps!

  • Hi, does someone know if I can use two Apple tv's with the same iTunes library? Thanks

    Hi, does someone know if I can use two Apple tv's with the same iTunes library?
    Thanks

    Yes you can use two (or more) AppleTVs with one iTunes library. They can both stream from iTunes (or the internet) at the same time, as long as you have a good working LAN and internet connection.

  • How can i adjust my display on videos.  Result is dark same as with the camera .  Thank you

    How can i adjust my display on videos and camera.  Result is dark same as with the macbook camera . When i play videos , its dark . Please help.
      Thank you

    Solution may be found if you search in the "More Like This" section over in the right column. 
    By camera you mean "iSight" try the suggestions in the article http://support.apple.com/kb/HT2090 and on EZJim's Website.  If no help, post in the iSight forum area. 

  • Can i set up my iPad and iPod to use iMessage between the two devices with the same Apple ID?

    Can i set up my iPad and iPod to use iMessage between the two devices with the same Apple ID? SO i could iMessage if out from my iPod to my iPad at home to be viewed by a family member?

    Look into using Apple Configurator.  It's the easiest way to "reimage" and Manage iPads that I know of right now. 
    http://itunes.apple.com/us/app/apple-configurator/id434433123?mt=12
    Also, look into using the Educational Volume Purchase Program, if you have not already done so. 
    http://www.apple.com/education/volume-purchase-program/

  • HT204053 can i have multiple iCloud accounts with the same Apple id

    Can i have multiple iCloud accounts with the same Apple id

    Welcome to the Apple Community.
    No, your ID is essentially your account. You can have email aliases and you can have multiple accounts, but I don't think that's what you are asking.

  • I created my Apple ID in Ireland, but would now like to switch to a German Apple ID, keeping the same email address. How do I delete my old Irish Apple ID, so I can create a new German one with the same email?

    I created my Apple ID in Ireland, but would now like to switch to a German Apple ID, keeping the same email address. How do I delete my old Irish Apple ID, so I can create a new German one with the same email?

    Welcome to the Apple Community.
    Click on your account name in the top right corner of the iTunes store in the iTunes application on your computer, enter your password and click the "view account" button. Navigate to the Apple ID summary where you have the option to "change country or region".
    In order to change your location, you will need a credit card registered to an address in the location you are trying to change to.
    You cannot change your location if you have credit on your account, if you are unable to spend your credit and leave a balance of zero, contact Apple, which you can do through iTunes Store Support.

  • How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    Phone A = phone with information you want duplicated
    Phone B = phone that you want to copy from A
    Backup Phone A.
    Wipe Phone B using these instructions. What to do before selling or giving away your iPhone, iPad, or iPod touch - Apple Support
    Phone B should be on the 'Hello' screen. Do not swipe it. Launch iTunes. Plug in Phone B.
    When iTunes asks if you want to set up as new phone or restore from backup, choose restore from backup of Phone A.
    After this setup, any changes to one phone (i.e. adding a contact, downloading an app) will have to be manually duplicated on the second phone, if that is your desire). Making changes to one phone will not affect the other after setup.

  • I can not join my Apple extreme with the Apple express. I shows a conflict in the network! I've tried everything. How can they join on the same network?

    I can not join my Apple extreme with the Apple express. I shows a conflict in the network! I've tried everything. How can they join on the same network?

    It says that my DHCP has to be changed! How? to what?
    It is 802.11g.express. but is set to default by the computer (Macbook Air).
    The other is 802.11n. (express)
    Extreme is 802.11.g. Is the Main Airport.
    It is on ethernet & wep 128 security.

  • I cannot connect my iPhone 4S to my home wifi. When trying to connect it says I have the wrong password, but I can connect my MacBook to the same network with the same password. I have tried to restart my router, reset my network settings, fail!

    Hello, I am having some major troubles connecting my iPhone 4S to my home wifi. When I try to connect on my phone, it says I have an incorrect password. That's not possible because I can connect my MacBook to the same network with the same password. I have reset my network settings on my phone, reset my router, called apple support, triple checked I was trying it in correctly, I have no clue what's going on.
    The only thing different is I just moved, but I have the same router/phone/internet provider.
    I've seen some discussions of router security options being the problem, I have my router connected to : WPA-PSK [TKIP] + WPA2-PSK [AES].
    The other options are: WEP , WPA-PSK[TKIP] , WPA2-PSK [AES] , WPA/WPA2 Enterprise.
    My troubleshooting and understanding of all this is pretty limited, my applecare service did not help, please can anyone help me?
    Thanks!

    If the issue happened after an update, you may want to go into an Apple Store. Be sure to let them know exactly what's wrong with the device.

  • TS1297 My numbers / symbols 1-9 / !-(  do not work on my wireless key pad.  I have tried the resolution information but, still no response with those keys only.  I can only type these keys with the keyboard viewer.  Any suggestions?

    My numbers & symbols 1-9 / !-(  do not work on my wireless key pad.  I have tried the resolution information but, still no response with those keys only.  I can type these keys with the keyboard viewer, thankfully.  Any suggestions?

    Unable to type while Mouse Keys is enabled in OS X

Maybe you are looking for

  • Firefox will not open ANY site. Wont work AT ALL. Nothing seems to be working.

    Firefox will not open ANY site. It worked last night, but not today. I uninstalled it many times, didn't worked. It displays the screen that says "unable to connect" yet chrome and explorer both work. I have disconnected and reconnected a few times,

  • Erratic Movement of Marker Pins in iPhoto 9.5 for Mac

    Newest version of iPhoto with Apple Maps seems to have a real problem when trying to manually place marker pins with precision in small Places map (i.e. - fine-tune location).  New pop-up-and-place-down routine in software seems to be VERY vulnerable

  • Camera Raw 6.4.1 won't install in CS5 Extended

    The Adobe Application Manager downloads and starts to install the update, then pauses with the message "Please close the following application to continue: Adobe Bridge CS5 (Bridge.exe)" even after a reboot with no Adobe software (apparently) running

  • Slow to issue commit

              I have been experiencing random delays for a JTA transaction using WLS6.0, SP2           & Sybase 12, on average the DB write happen pretty fast. However, once a while           they delay would go up to seconds, even 15 seconds or so.     

  • Run IBOTS based on ETL

    Hi experts , We are using Windows server for OBIEE 10g. We need to start IBOT and populate our cache as soon as ETL ends. Any suggestion..? Is there any ways to populate cache ? We want to have all entries in our cache before our business starts. Tha