How to pass binary key to openssl

2.1k Views Asked by At

I'm stumped trying to pass the key parameter to openssl dgst. I'm trying to interface to the GDAX trading platform and each request must be signed by HMAC. They clearly say to

"first base64-decode the alphanumeric secret string (resulting in 64 bytes) before using it as the key for HMAC."

This results in a 64-byte binary string. But the openssl command line program simply says -hmac key meaning that you supply the key as a parameter on the command line, which is fine if it is simple ASCII. But I see no way to supply a binary string of bytes as the key. Is there a way to do this?

(also any general advice about directing GDAX with curl is welcome too)

1

There are 1 best solutions below

0
On BEST ANSWER

You can specify a binary key in hex format like this:

$ openssl dgst -mac hmac -macopt hexkey:0102030405 myfile