访问 Fabric CA 服务器 REST Api(涉及授权的方法)

Accessing Fabric CA server REST Api (Methods that involve Authorization)

https://github.com/hyperledger/fabric-ca/blob/release-1.2/swagger/swagger-fabric-ca.json
使用上面的link作为参考,我用cainfo方法成功了(使用localhost:7054/api/v1/cainfo)。但是,对于需要身份验证 header 的其他方法,如从属关系 (get),我失败了(该方法表示需要 2 个由句点分隔的 base 64 编码密钥)。我的问题是实际需要什么密钥(管理员证书和私有 key/sign ?)以及我是否应该对它们进行编码(通过 https://www.base64encode.org/ 完成编码)

注意:- 这是预期的

  {
        "name": "Authorization",
        "in": "header",
        "description": "An HTTP basic authorization header where:  \n*  *user* is the enrollment ID;  \n*  *password* is the enrollment secret.",
        "required": true,
        "type": "string"
      },

您可以在终端中通过运行获得授权header:

      echo -n admin:adminpw | openssl base64

这会输出一个令牌,该令牌应在 CURL 请求中使用(或通过邮递员,如果需要的话)。

您需要在 base64 中单独创建名称和密码

echo -n admin | openssl base64

YWRtaW4=

echo -n adminpw | openssl base64

YWRtaW5wdw==

字段授权将是YWRtaW4=.YWRtaW5wdw==

别忘了“.”在名称和密码之间!