Help with password encryption
Hello I am trying to create a one way hash password encryption...here is what I have developed so far.....
Login class (contains GUI)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.awt.image.*;
import javax.imageio.*;
public class Login implements ActionListener
// declare class variables and objects
// overall frame
private FrameBase jf;
// buttons
private JButton btnNewUser,btnLogin;
// data display labels
private JLabel lblMessage, lblUser, lblPassword, lblTitle, lblCheck,lblNotes;
// text fields for data entry
private JTextField txtUser, txtPassword,txtCheck;
// graphic object
private BufferedImage eSay;
// panels for organization
private JPanel pnlTitle, pnlMain, pnlGraphic;
// font objects
private Font fntTitle, fntMain, fntControl,fntNotes;
// user name for repeated set screen calls
private String name;
// store screen layout option code
private int option;
// option 1 - regular start-up
// option 2 - new user screen
// option 3 - user / password check
public Login(String name)
// set up the fonts
fntTitle=new Font("Helvetica", Font.BOLD, 25);
fntMain=new Font("Helvetica", Font.BOLD, 20);
fntControl=new Font("Helvetica", Font.BOLD, 15);
fntNotes=new Font("Helvetica", Font.BOLD, 16);
// set the BufferedImage object to null;
eSay=null;
try
// load the image from disk into a BufferedImage object
eSay=ImageIO.read(new File("h:\\My documents\\ICS4M1\\Login\\eSay.jpg"));
// set up the screen
this.name=name;
this.option=1;
setScreen(name);
catch (IOException e)
// message if file not found
System.out.println("Image not found");
public void setScreen(String name)
jf= new FrameBase(name);
// set up the screen
Container contentPane=jf.getContentPane();
contentPane.setLayout(new BorderLayout());
// set up the graphic
pnlGraphic=new JPanel();
pnlGraphic.setLayout(new BorderLayout());
// load the BufferedImage into the ImageLabel
ImageLabel il=new ImageLabel(eSay,"");
// load the ImageLabel onto the panel
pnlGraphic.add("Center",il);
// set up the title section
lblTitle=new JLabel("Welcome to eSay",0);
lblTitle.setFont(fntTitle);
lblMessage=new JLabel("Enter user name and password and click on Login or click on New User to set up a new account",0);
lblMessage.setFont(fntControl);
// set up the panel for the title area
pnlTitle=new JPanel();
pnlTitle.setLayout(new GridLayout(2,1));
pnlTitle.add(lblTitle);
pnlTitle.add(lblMessage);
// set up the input section of the screen
lblUser=new JLabel("User: ");
lblUser.setFont(fntMain);
lblPassword=new JLabel("Password: ");
lblPassword.setFont(fntMain);
lblCheck=new JLabel("Re-Type Password: ");
lblCheck.setFont(fntMain);
lblCheck.setEnabled(false);
lblNotes=new JLabel("<html><font color=\"red\">User name 6 to 10 alphanumeric characters, password 5 to 8 alphanumeric characters, </font></html>",0);
lblNotes.setFont(fntNotes);
txtUser=new JTextField(20);
txtUser.setFont(fntMain);
txtPassword=new JTextField(20);
txtPassword.setFont(fntMain);
txtCheck=new JTextField(20);
txtCheck.setFont(fntMain);
txtCheck.setEnabled(false);
btnLogin=new JButton("Login");
btnLogin.setFont(fntMain);
btnNewUser=new JButton("New User");
btnNewUser.setFont(fntMain);
// make the button active
btnLogin.addActionListener(this);
btnNewUser.addActionListener(this);
// assemble the input section panel
pnlMain=new JPanel();
pnlMain.setLayout(new GridLayout(5,2));
pnlMain.add(lblUser);
pnlMain.add(txtUser);
pnlMain.add(lblPassword);
pnlMain.add(txtPassword);
pnlMain.add(btnNewUser);
pnlMain.add(btnLogin);
pnlMain.add(lblCheck);
pnlMain.add(txtCheck);
// add the panels to the screen
contentPane.add(pnlTitle,"North");
contentPane.add(pnlGraphic,"Center");
contentPane.add(pnlMain,"East");
contentPane.add(lblNotes,"South");
// set up and show the frame
jf.setSize(900,400);
jf.show();
} // end of setScreen()
public void actionPerformed(ActionEvent e)
if (e.getSource()==btnNewUser)
if (option==1)
lblCheck.setEnabled(true);
txtCheck.setEnabled(true);
lblMessage.setText("Create a login name and password, enter the password twice as indicated");
btnLogin.setEnabled(false);
option=2;
else if (option==2)
String tempUser=txtUser.getText();
String tempPassword=txtPassword.getText();
String tempCheck=txtCheck.getText();
if (tempPassword.equals(tempCheck))
ValidateUser vu=new ValidateUser(tempUser,tempPassword);
if (vu.getEncryptedPassword()==null)
lblMessage.setText("Please check guidelines for user name and password and re-enter");
else
lblMessage.setText("Login created - Welcome to eSay!");
else
lblMessage.setText("Passwords do not match, please re-enter login and password twice");
else if (e.getSource()==btnLogin)
} // actionPerformed
public static void main(String args[])
Login l=new Login("eSay Message Board");
} // end class Login User class
public class User
private String userName;
private String password;
private int numberLogins;
public User(String userName, String password)
this.userName=userName;
this.password=password;
this.numberLogins=0;
// gets for surname, first name and number of logins
public String getUserName()
return userName;
public int getNumberLogins()
return numberLogins;
public void resetLogins()
this.numberLogins=0;
public void login()
this.numberLogins++;
public static void main(String args [])
// enter test statements here
} // end of User classValidate User(validation)
System.out.println ("A character is invalid");
return false;
return true;
// create an encrypted password if user name and password are valid
public void encryptPassword()
// standard get for encrypted password
public String getEncryptedPassword()
return encryptedPassword;
}PasswordService(One way hash conversion)
package org.myorg.services;
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()
public synchronized String encrypt(String plaintext) throws SystemUnavailableException
MessageDigest md = null;
try
md = MessageDigest.getInstance("SHA");
catch(NoSuchAlgorithmException e)
throw new SystemUnavailableException(e.getMessage());
try
md.update(plaintext.getBytes("UTF-8"));
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;
}
I was wondering if someone could help me to incorporate some kind of one way hash into the encryptPassword method in Validate user...i am having problems trying to call on the PasswordService and incorporating everything. The reason i supplied all the code was so that the reader could understand how different programs correlate with one another
Similar Messages
-
Trouble With Password Encryption in Acrobat 8.1 Professional
Can someone suggest a solution or are you experiencing the same problem? Each time I g
o to password encrypt, I get an erro message saying that 8.1 encountered an error and is closing.
This happens several seconds after clicking on the passord radio button.Not that silly; but you ideally shouldn't be trying. Although there are some rudimentary (and sometimes unpredictable) editing tools in Acrobat, (I presume you are trying with the TouchUp Object tool as well as the TouchUp Text ?) much better to get it right in the source application and think of the pdf as what it basically is...a print.
For whatever reason, v5 could edit text positioning rather more easily than the later versions. -
Hello friends,
Can anyone out there tell me or point me to information on how to set up the ASE_ENCRYPTION option for version 15.7?
I have an existing ASE installation for testing purposes. I want to install the encryption option there but I cannot locate any
step-by-step documentation on how to do that. The ASE 15.7 Encrypted Columns Users Guide simply states:
"Install the license option ASE_ENCRYPTION. See the Adaptive Server Enterprise Installation Guide."
and when I go to the ASE Installation Guide it refers me to the SySam User's Guide...
and when I go to the SySam User's Guide it gives no instructions on *how* to install the encryption option.
So, to summarize:
1.) Do I need to generate a license file that includes the ASE_ENCRYPTION option and start ASE with this license file? I was
told by someone at SAP that there should be a way to get and use this option for thirty days (grace license) while we test
and evaluate.
2.) If above is true, will this work with the Developer's Edition of ASE or do I have to get a Enterprise Edition SR or SV
license? (By the way, I do have an available SV license for Enterprise. I generated the license file and it shows that this license includes
a package of Components= ASE_CORE Options=SUITE)
Any help with this will be appreciated.Thanks for your help Ajit,
I believe you are correct. I was told that the ASE_ENCRYPTION option was already packaged with the software so all I had to do was "turn it on". For some reason I was thinking it had to be installed via a script or something.
Anyway, I have successfully "turned on" the option using :
sp_configure "enable encrypted columns", 1
go
I will now attempt to create an encryption key and go forward with data encryption.
Thanks again for your input -
Hi All I hope you can help me with a big password problem. I have a wireless network at home with two wireless computers on it and a hardwired unit. I use the Linksys wireless router WRT54GS. I want to install a third wireless computer on this network, but I cannot remember my network password to enable access for this computer. is there any way to gain access to the uncoded version of my password to enable me to put it into the new unit? If this will not be possible, can I uninstall my entire network and install it new again, with a new password, etc. what other options do I have to enable the new computer to work on this network? Any help will be greatly appreciated! Have a great day All
Which password did you forget? Your router login password, or your encryption password?
If you forgot your router login password, try "admin" (with no quotes). If you cannot login to your router, the only solution is to reset your router to factory defaults (using the reset button), (then "admin" should work), then setup the router again from scratch.
If you forgot your encyption password, you are in luck. Login to your router, then go the the "Wireless" tab, "Wireless Security" subtab. Your encryption key should be listed on this page, or someplace nearby. -
Hi, anyone can help me with my password for the WRT54G router. I am trying to reconfigure it, but is asking me for a password. I reset the back bottom, and I entered "admin", but still does not work. It does not go on with the set up.
Thanks, MaribelWelcome to the Cisco Home Community.
Type 192.168.1.1 on your browsers address bar.
When prompted for a password, leave username blank and type admin in the password field.
Enter your configurations.
Do post back for any updates.
The Search Function is your friend.... and Google too.
How to Secure your Network
How to Upgrade Routers Firmware
Setting-Up a Router with DSL Internet Service
Setting-Up a Router with Cable Internet Service
How to Hard Reset or 30/30/30 your Router -
Help with Password Management!!!
I am having a problem configuring my OID password management options... the Admin guide says that I can do it through Directory Manager by selecting the server in the left hand pane and editing the data on the password management tab... problem is I have no password management tab... it's not there!
So I notice that I can also use the command line tools to modidy the entry "cn=pwdpolicyentry,cn=oracle internet" directory. I assume that "cn=oracle internet directory" is the top level of my tree... doing a search for anything cn=* from the top level results in three things as follows... none of them are the entry I want:
cn=configset1,cn=metadird,cn=configsets,cn=oracle internet Directory
cn=odipgroup,cn=odi,cn=oracle internet directory
cn=odisgroup,cn=odi,cn=oracle internet directory
OK... so in desperation I attempt to add the entry "cn=pwdpolicyentry,cn=oracle internet directory" and the server says it already exists.
Seems to me there is something messed up with my Directoty Information Tree but I don't know why that would be (I just installed and the install gave me no errors) or how to fix it. Can someone please help???
Thanks
ChrisQuerying the password policy entry can be a little bit tricky unless you are very familiar with LDAP. Here's the command that does the trick:
ldapsearch -s base -b "cn=pwdpolicyentry,cn=oracle internet directory" "(objectclass=*)"cn=pwdpolicyentry,cn=oracle internet directory
objectclass=top
objectclass=pwdpolicy
cn=pwdpolicyentry
pwdmaxage=0
pwdlockout=0
pwdlockoutduration=0
pwdmaxfailure=0
pwdfailurecountinterval=0
pwdexpirewarning=0
Kind regards, Wilfried -
Help with password and authorization
I had a problem with my Kobo recently and had to reinstall both the Kobo and ADE on my computer. The 2.0 version did not work but I finally found the 172 and downloaded it. I cannot however get the 2 to connect and think I may have tried to many times. I decide to try getting books on my IPad and did not know if I needed to set up a new adobe account , but since the other did not seem to want to authorize anything I set up a new one, same email but different password. When I put the password in it kept telling me that it was the wrong one, and now I need to have my authorization count reset. How do I do that and do I use the same login and password for my computer and my IPad. My computer has Windows XP on it. Please can you help as I am lost without a book to read.
ThanksHello
I understand that it is difficult to determine which forum to post in since there are so many. This particular forum (sharing and storage) was created to help those transitioning from Photoshop.com to Adobe Revel. Here is a link for resetting your Adobe ID as we dont provide support for viewing the ebooks
Click on the link below that says trouble signing in
https://www.adobe.com/account/sign-in.adobedotcom.html
Thanks
Scott -
Help with RSA Encryption using SATSA
Hello,
I am a new to writing code on J2ME . I am trying to encrypt data using
RSA public key on J2ME using SATSA.
I generated the public key using openssl in the PEM format and stored the
key (mypublickey) as a Base64 decoded byte array in my code.
Next, I did the following:
X509EncodedKeySpec test - new X509EncodedKeySpec(mypublickey);
KeyFactory kf = KeyFactory.getInstance("RSA");
PublicKey key = kf.generatePublic(test);
I used this key to encrypt as follows:
cipher c = Cipher.getInstance("RSA");
c.init(Cipher.ENCRYPT_MODE, key);
c.doFinal(data,0,data.length,ciphertext,0);
where byte[] data = "1234567890".getBytes();
I get no errors during this process.
Now, when I try to decrypt the string, I get a padding error as follows:
javax.crypto.BadPaddingException: Data must start with zero
The decode is done on a server.
I tried getting an instance of the cipher with RSA/ECB/NoPadding and this time the decrypt gives junk.
Question 2: The SATSA example online at http://java.sun.com/j2me/docs/satsa-dg/AppD.html
has a public key embedded as a byte array. They haven't explained how
this key is generated. Does someone know?
Question 3: Suppose, I can get the modulus and exponent of the public key is there any way I can convert it to X509EncodedKeySpec so that I can
use the APIs in SATSA?
Thanks in advance for your help. I have been trying to solve this for a lot of time and any help will be greatly appreciated.Just wanted to add my code:
public class test2 {
public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, ShortBufferException {
// TODO Auto-generated method stub
byte [] data = "012345678901234567890123456789ab".getBytes();
Base64 base64 = new Base64();
/*public key generated by
byte [] mypublickey = base64.decode("publickey in PEM format");
byte [] ciphertext = new byte[128];
X509EncodedKeySpec test = new X509EncodedKeySpec(mypublickey);
byte [] myprivatekey = base64.decode("privatekey in pkcs8format");
KeyFactory rsakeyfac = KeyFactory.getInstance("RSA");
PublicKey pubkey = rsakeyfac.generatePublic(test);
Cipher c1 = Cipher.getInstance("RSA");
c1.init(Cipher.ENCRYPT_MODE, pubkey);
c1.doFinal(data, 0,data.length, ciphertext);
PKCS8EncodedKeySpec pks2 = new PKCS8EncodedKeySpec(myprivatekey);
RSAPrivateCrtKey privkey = (RSAPrivateCrtKey)rsakeyfac.generatePrivate(pks2);
Cipher c2 = Cipher.getInstance("RSA");
c2.init(Cipher.DECRYPT_MODE, privkey);
byte [] decrypteddata = c2.doFinal(ciphertext);
System.out.println("Decrypted String is:"+new String(decrypteddata).trim());
Error that I get is:
Exception in thread "main" javax.crypto.BadPaddingException: Data must start with zero
at sun.security.rsa.RSAPadding.unpadV15(Unknown Source)
at sun.security.rsa.RSAPadding.unpad(Unknown Source)
at com.sun.crypto.provider.RSACipher.a(DashoA13*..)
at com.sun.crypto.provider.RSACipher.engineDoFinal(DashoA13*..)
at javax.crypto.Cipher.doFinal(DashoA13*..) -
Help with Password Set up WRT54G
I set up this router forever ago and apparently it says I created a password, but I don't remember doing so and I have no idea what the password would be in order to set it up again on my computer. Is there a way to reset or use something else. I tried using Admin and that isn't working either. Please Help. Thanks
Have you been running an unsecured wireless network? With a router login password of "admin" ? If so, then most likely your neighbor wirelessly connected to your router (intentionally or unintentionally) and changed your login password.
The only way to remove the password is to reset the router to factory defaults, then setup the router again from scratch. After you have done this, to prevent this problem from recurring, be sure to change the login password from the default of "admin", and secure your wireless network.
To reset your router to factory defaults, use the following procedure:
1) Power down all computers, the router, and the modem, and unplug them from the wall.
2) Disconnect all wires from the router.
3) Power up the router and allow it to fully boot (1-2 minutes).
4) Press and hold the reset button for 30 seconds, then release it, then let the router reset and reboot (2-3 minutes).
5) Power down the router.
6) Connect one computer by wire to port 1 on the router (NOT to the internet port).
7) Power up the router and allow it to fully boot (1-2 minutes).
8) Power up the computer (if the computer has a wireless card, make sure it is off).
9) Try to ping the router. To do this, click the "Start" button > All Programs > Accessories > Command Prompt. A black DOS box will appear. Enter the following: "ping 192.168.1.1" (no quotes), and hit the Enter key. You will see 3 or 4 lines that start either with "Reply from ... " or "Request timed out." If you see "Reply from ...", your computer has found your router.
10) Open your browser and point it to 192.168.1.1. This will take you to your router's login page. Leave the user name blank, and in the password field, enter "admin" (with no quotes). This will take you to your router setup page. Note the version number of your firmware (usually listed near upper right corner of screen). Exit your browser.
If you get this far without problems, try the setup disk (or setup the router manually, if you prefer), and see if you can get your router setup and working.
If you cannot get "Reply from ..." in step 9 above, your router is dead.
If you get a reply in step 9, but cannot complete step 10, then either your router is dead or the firmware is corrupt. In this case, use the Linksys tftp.exe program to try to reload your router with the latest firmware. After reloading the firmware, repeat the above procedure starting with step 1.
If you need additional help, please state your ISP, the make and model of your modem, your router's firmware version, and the results of steps 9 and 10. Also, if you get any error messages, copy them exactly and report back.
Please let me know how things turn out for you.
Message Edited by toomanydonuts on 12-29-2007 04:07 AM -
I have tried to reset my password and I do not recieve the email for this reset. I have had an issue with verifiying my account also as the email for the verification does not get sent to my account either. This has been going on for quite sometime. I have call support and they were of no help. I just want your systems to see my email address so I can log in.
Hello cisconetdude,
Managing your account information on BestBuy.com should be pretty easy, so I'm disheartened to hear that you've had the difficulties you describe. This is not the experience that we want you to have!
I'll be happy to look into this situation for you, but will need you to confirm some information to begin. Please watch for a private message from me with that request. To check your forum inbox, ensure that you have signed in with your user name and password, then click on the envelope icon in the upper right of this page.
I'm grateful that you brought your circumstances to our attention.
Sincerely,
John|Social Media Specialist | Best Buy® Corporate
Private Message -
Please help me to stop stressing about it.Last year i open an account for my mom on her phone, now today she texted me she cant use it anymore because i guess app had update and log her out and i dont know which password did i use. I tried recovery but then she doesnt know to use email to see recovery link and i cant log in on her account because i dont know password again. She is 63 years old and this is her first android, no skills what so ever. And here is an suggestion, there is thousands people like my mom who doesnt know how to recover or sign in back, and no help around to resolve the problem so after an update it would be nice if they dont need to sign in again, who ever has that issue skype or android to fix it.
I have a 2501 that I am using for CCNA practice. After reading this thread I decided to try to interrupt the boot sequence on my router as a learning experience.
I too am unable to do so!
Perhaps I am mistaken about what the "break key" is when using hyper terminal.
I assumed that it meant holding down the "Ctrl" key while pressing the "c" key. Is this correct?
The book that I am using is very vague on this point.
Also Hyper Terminal can be configured with many options. [ANSI or VT100 etc.] Could a specific configuration be needed for the break function to work? -
Help with password for voicemail
new phone trying to set up voicemail and don't remember old password
Blainesadie,
Contact your service provider for help in resetting your voicemail password. -
hey i have had to pin protect my mobile to keep my brother from going through it but now he has typed in the password so many times that it is on its last attempt.
but the problem is that i only remember putting in a 4 digit pin protection not a password and i dont want to loose everything from my phone. what do i do?Any chance you recall if you have the application BlackBerry Protect installed on the device? If so, you might have been making backups and not know it.
Meanwhile, yes, your 10th wrong entry will wipe your device of all personal data, contacts, calendar, messages, etc.
Often users who have multiple numerals in their password will only press the ALT key for the first numeral and not those following, so for instance, if your password were "1234", you might have been pressing "Alt 1234" on the device, which makes the actual password to be "1ers".
Does that make sense? Does it sound familar to your usage? DO you remember in the past press the ALT key for each number?
So check the way you enter your password on the device... do you think you are entering multiple numbers but actually are not?
1. If any post helps you please click the below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
4. Guide to Unlocking your BlackBerry & Unlock Codes
Join our BBM Channels (Beta)
BlackBerry Support Forums Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
I keep a list of passwords in my BlackBerry using the Password Keeper application. When I enter my password, I am getting the following message:
“A password entry created on 1/28/2008 is protected by an old password. Please enter the old password to convert the entry:” If I select Delete Entry, it gives me the same message but changes the date of the entry.
The password I am entering is correct but I don’t know the password entry created on the listed date(s). I have used the same password since I received this BlackBerry. Password Keeper will not accept any password that I enter.
PLEASE HELP! I have numerous passwords stored that I can't access.
Thanks for any help you can provide.absolutely,
I would recommend Desktop Manager, version 5, withOUT the Media Manager. Download Desktop Manager from here:
https://www.blackberry.com/Downloads/entry.do?code=A8BAA56554F96369AB93E4F3BB068C22
1. If any post helps you please click the below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
4. Guide to Unlocking your BlackBerry & Unlock Codes
Join our BBM Channels (Beta)
BlackBerry Support Forums Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
Help with password for my laptop
Hello I bought this laptop off my cousin so I can do my college classes online and hang out at star bucks to but it ask for a password and he Thought it was Hus wife's name well turned out it wasn't and after u enter it 3 times it disables it and says this [ 01259 ] can you please help me ASAP ty so much and god bless
This question was solved.
View Solution.Ty sir it worked and wow been looking and looking then seen u guys on a blog and less than 10 mins I'm in ty so much
Maybe you are looking for
-
When I follow any kind of links or try to open something in another window or new tab, the browser first shows the white page with text "the document has moved", and then moves to advertisement page of some sort. Usually in the small box where the pa
-
Go back to Windows?-Your advisement appreciated.
My wife, being the graphic/music affectionado she is, had always been frustrated by trying to work in the pre XP Windows environment...no matter how much horsepower she would throw at her programs, inevitibly projects would crash and burn at the most
-
CS Extension Check In event for InDesign and Illustrator
Hi, For CS6 InDesign Similar to DocumentEvent.BEFOR_SAVE, do we have anything for check in event as well, I am using cs 1.5 sdk. If that is not available, how we can implement such a functionality. Do we have to use Indesign SDK or are there any alte
-
How many concurrent installs in PS Elements 7?
I read that Lightroom allows you to install it on two different computers, although you can only run it on one computer at a time. Is it the same for other products such as PS Elements 7? Thanks.
-
Updating custom mseg fields from CO11N screen
Hello all, When i save an order from co11n screen, it creates a record in mseg table. I created some custom fields in mseg table and i want to fill them during this co11n screen fills the mseg table, but i couldnt find the correct user exit or enhanc