File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes NoSuchAlgorithm for KeyGenerator.getInstance( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "NoSuchAlgorithm for KeyGenerator.getInstance("HmacMD5")" Watch "NoSuchAlgorithm for KeyGenerator.getInstance("HmacMD5")" New topic

NoSuchAlgorithm for KeyGenerator.getInstance("HmacMD5")

Jeff Breeden

Joined: Jan 23, 2013
Posts: 2
In a Spring MVC web app, I'm getting a NoSuchAlgorithmException from both Eclipse and Maven on

The javax.crypto packages are imported (the KeyGenerator object is recognized) so if I'm reading correctly, it is not finding MD5 in any available provider.
In the project properties it has jce.jar in the build path in the jre6\lib folder. Is there any other file or path I should check? Do I need something in my project folder?

Richard Tookey

Joined: Aug 27, 2012
Posts: 1166

HmacMD5 works for me in 1.7 and has worked in all SunJCE providers I can remember for the last 10 years or so. Are you sure the NoSuchAlgorithmException is coming from that line?

The program I use for checking which provider provides which algorithms is -
Jeff Breeden

Joined: Jan 23, 2013
Posts: 2
I was mis-reading it. I needed "throws NoSuchAlgorithmException" on the method definition. Thank you for the response.
I agree. Here's the link:
subject: NoSuchAlgorithm for KeyGenerator.getInstance("HmacMD5")
It's not a secret anymore!