Recently had a problem with
java.security.NoSuchAlgorithmException: Algorithm HmacSHA1 not available
Tried to isolate the problem, using this simple code:
import java.security.NoSuchAlgorithmException; import javax.crypto.Mac; public class Main { public static void main(String... args) { final String HMAC_SHA1_ALGORITHM = "HmacSHA1"; Mac instance; try { instance = Mac.getInstance(HMAC_SHA1_ALGORITHM); } catch (NoSuchAlgorithmException e) { final String errmsg = "NoSuchAlgorithmException: " + HMAC_SHA1_ALGORITHM + " " + e; // ... } } }
The thing is that this works in one of my Eclipse instances, and not on the other. All tested using New Java Project, pasting the above, and running, so this should be due to some settings difference between the Eclipse instances.
I've tried to look through all the seemingly relevant settings (classpath, JRE, java compiler), but nothing that looks different or makes it work if changed. (If someone knows how to 'diff' the settings of two Eclipses, do tell!)
I'm resorting to simply using a third Eclipse (where it works (so far)), but it would still be interesting to learn what this potentially infuriating problem is really down to.