Hello. I need to Generate a HMAC-key by base64-decoding a given key (resulting in 64 bytes). Then I need to use the HMAC-key to create a sha256 HMAC with a given string (I should expect a digest output). Last I need to convert the result (the signature) into a base64-encoded result.
For some reason I do something wrong...
key_uint8 = uint8(key);
key = typecast(org.apache.commons.codec.binary.Base64.decodeBase64(key_uint8), 'uint8')';
Signature = HMAC(key,string,'SHA-256');
I use the HMAC Hash Message Authentication Code Function by Peter Grunnet Wang. https://se.mathworks.com/matlabcentral/fileexchange/46182-hmac-hash-message-authentication-code-function
I do not think it is the base64 decoding and encoding that goes wrong. I think it is the HMAC since I do not get a digest output. Does anyone know a way around this ?