如何将二进制密钥传递给openssl [英] How to pass binary key to openssl
问题描述
我很想尝试将key参数传递给openssl dgst
.我正在尝试连接GDAX交易平台,并且每个请求都必须由HMAC签名.他们清楚地对
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
第一个base64解码字母数字秘密字符串(结果为64 字节)作为HMAC的密钥."
"first base64-decode the alphanumeric secret string (resulting in 64 bytes) before using it as the key for HMAC."
这将导致一个64字节的二进制字符串.但是openssl命令行程序只是说-hmac key
,这意味着您可以在命令行上将密钥作为参数提供,如果它是简单的ASCII,就可以了.但是我看不到提供字节的二进制字符串作为键的方法.有办法吗?
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?
(也欢迎使用curl
指导GDAX的任何一般建议)
(also any general advice about directing GDAX with curl
is welcome too)
推荐答案
您可以按以下十六进制格式指定二进制密钥:
You can specify a binary key in hex format like this:
$ openssl dgst -mac hmac -macopt hexkey:0102030405 myfile
这篇关于如何将二进制密钥传递给openssl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!