-
Notifications
You must be signed in to change notification settings - Fork 189
Description
I would like to raise an issue regarding the handling of HMAC secret keys in the library. Currently, the library requires placement of the HMAC secret key inside the keyInfoProvider during HMAC signature verification. However, the KeyInfoProvider is meant to contain public keys, not secret keys. In the context of HMAC, getKeyInfo() (or getKeyInfoContent()) is not needed.
Also, putting a HMAC key in the keyInfoProvider during the signing process poses a potential security risk as it could lead to the leakage of the HMAC secret key inside the KeyInfo element.
I propose that the library should adopt a more appropriate approach for HMAC verification. Instead of using the KeyInfoProvider, it would be advisable to use the signingKey property for both HMAC signing and verification, as it ensures consistency in symmetric key usage.
This change would have the additional benefit of KeyInfoProvider no longer having to handle HMAC keys, and parsing solely PEM keys.
Suggested Solution:
-
Update the documentation to emphasize the use of the signingKey property for HMAC verification -
Do not use keyInfoProvider during HMAC signing and verifying -
Fix the HMAC tests
Please let me know if any further information is needed.