7067 - CRE Module IP: How to check and compute the HMAC-SHA256 value generated by CRE Module IP?

7067 - CRE Module IP: How to check and compute the HMAC-SHA256 value generated by CRE Module IP?

User may use conventional online OpenSSL or HMAC generator to calculate the HMAC-SHA256 value.

However, few things to take note with OpenSSL vs Online HMAC generator:

1.       Online HMAC generator key is in string format while OpenSSL can be either hex or string

2.       OpenSSL plaintext code is store in a file. There must not be any additional line or spacing after the code. The additional char spacing will be taken into hash computation resulting in different signature


Online HMAC Generator Example 

Both online tools generated the same hashed output as shown below:

Secret key: 04EB9FFD13B40022D349833BB353A4CD7C1AEE5CB7AEE3E1ACED216487F77C99
 
Plain text: 112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00

https://www.devglan.com/online-tools/hmac-sha256-online

OpenSSL Crypto Library Example

Installation guide:

Example command: openssl dgst -sha256 -mac HMAC -macopt hexkey:<secret_key> <plain_text_file>

Example below used string instead of hex format to align the output result with online tool.
openssl dgst -sha256 -mac HMAC -macopt key:04EB9FFD13B40022D349833BB353A4CD7C1AEE5CB7AEE3E1ACED216487F77C99 test.txt