After the last question I asked I am a little gun shy (stupid question)...but this time I have looked into it in the books and online and they all say I am doing it right. Unfortunately, it doesn't work, so I must not be doing it right... What am I missing?
This method is being called from a button click on an applet. The password box sends in the password they typed and then setPassword is supposed to encrypt the password before storing it:
When I run the applet, I am getting an "Access Denied" error (the debugger I am using is not that helpful). I tracked the error down to the declaration of the MessageDigest (single step...didn't crash...single step...didn't crash...single step...CRASH!!). I don't receive any error messages except that the debugger had an internal error retrieving the stack trace (isn't that wonderful?).
I did see one post about applets not playing well with BASE64ENCODER, but that's as close as I got.
Does anyone see what I am doing wrong?
This method is being called from a button click on an applet. The password box sends in the password they typed and then setPassword is supposed to encrypt the password before storing it:
Code:
public void setPassword(byte[] pass)
{
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.reset();
md.update(pass);
pass = md.digest();
password = new sun.misc.BASE64Encoder().encode(pass);
}
catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
catch(Exception e){
e.printStackTrace();
}
}
I did see one post about applets not playing well with BASE64ENCODER, but that's as close as I got.
Does anyone see what I am doing wrong?