Skip to content

HMAC key usage in KeyInfo #303

Description

@shunkica

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions