base64 encoding signature issues

I am trying to base64 encode the signature as descried in these docs here: https://docs.gdax.com/#signing-a-message In python3 i am able to generate the simple base64 encoded signature here:

timestamp = ‘1525790592’

message = timestamp + ‘GET’ + ‘/fills’

message = message.encode(‘ascii’)

hmac_key = base64.b64decode(secret_key)

print(hmac_key)

print(message)

signature = hmac.new(hmac_key, message, hashlib.sha256)

signature_b64 = base64.b64encode(signature.digest()).decode(‘utf-8’).rstrip(‘\n’)

In Q, I have tried what I do with binance via the folllowing using qcrypt https://github.com/tjcelaya/qcrypt:

hmac:qcrypt 2: (hmac;3);

nonceGen:{[str]

 nonce:hmac[skey; str; “sha256”];

 nonce: “” sv string nonce;

 :nonce;

 };

however I do not think this does the proper base64 decoding of the secret key or the base64 encoding of the signature. Any Idea on how to do this effectively?

Not sure of that library but you can check this one if thats giving right one or not:

https://github.com/asatirahul/cryptoq/

Thanks for letting us know! Your repo now listed at code.kx.com/q/github/#utilities.

Best

Stephen




Stephen Taylor | Librarian | Kx | +44 7713 400852 | stephen@kx.com