Could not init hashing algorithm "HmacSHA<#>" with FIPS enabled
Issue
- When FIPS is enabled, the application fails with the following error:
java.lang.RuntimeException: Could not init hashing algorithm "HmacSHA256"
! sun.security.pkcs11.wrapper.PKCS11Exception: CKR_KEY_TYPE_INCONSISTENT
! at sun.security.pkcs11.wrapper.PKCS11.C_SignInit(Native Method)
! at sun.security.pkcs11.P11Mac.initialize(P11Mac.java:177)
! at sun.security.pkcs11.P11Mac.engineInit(P11Mac.java:206)
...
! Causing: java.security.InvalidKeyException: init() failed
! at sun.security.pkcs11.P11Mac.engineInit(P11Mac.java:208)! at javax.crypto.Mac.chooseProvider(Mac.java:350)
! at javax.crypto.Mac.init(Mac.java:415)
...
! Causing: java.lang.RuntimeException: Could not init hashing algorithm "HmacSHA256"
...
java.security.NoSuchAlgorithmException: HmacSHA1 KeyGenerator not available
Environment
- Red Hat Enterprise Linux (RHEL)
- 8
- OpenJDK
- 8
- 11
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.