Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.security.MessageDigest what am I doing wrong?

843811Apr 17 2008 — edited Apr 18 2008
Hi,

I'm new to java and I'm trying to implement java.security.MessageDigest in my app so I can store user passwords, but I keep getting the following compile error
test_app.java:9: unreported exception java.security.NoSuchAlgorithmException; must be caught or declared to be thrown 
        MessageDigest md = MessageDigest.getInstance("SHA-1");
I have javac 1.6.0_05 installed on my MS Windows XP SP2 laptop along with netbeans 6.0.1

I have imported the java.security.MessageDigest class at the start of my class file but can't seem to get past the first hurdle, what am I doing wrong?
According to all the documentation I have read so far JCA and JCE are installed as part of the JDK and they should provide me with all the providers needed to implement the SHA-1 or MD5 Algorithms.

Also is there a BASE64 encoding class in the java library?

Any assistance in this would be very grateful,
Martin.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2008
Added on Apr 17 2008
3 comments
1,870 views