解密超级账本中的有效载荷 [英] Decrypting the payload in hyperledger

查看:51
本文介绍了解密超级账本中的有效载荷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为Hyperledger Fabric使用Developer Environment.我尝试使用GET检索块信息,但确实给了我一个响应.但是,在响应中,有一个称为有效负载的组件,并且它的格式不可读.有没有办法使它可读/解密?例如,在bluemix中,当您对方"a"和方"b"进行初始化时,有效负载显示inita100b100.

I am currently using Developer Environment for Hyperledger Fabrics. I tried using GET to retrieve block info and it does give me a response. However, in the response, there's one component called payload, and it's in a unreadable format. Is there a way to make it readable/decrypt it? For instance, in bluemix, when you do init of party "a" and party "b", the payload shows inita100b100.

首先,我执行了该事务/REST请求

Firstly, I did this transaction/REST request

{
  "jsonrpc": "2.0",
  "method": "invoke",
  "params": {
      "type": 1,
      "chaincodeID":{
          "name":"mycc"
      },
      "ctorMsg": {
         "function":"invoke",
         "args":["a", "b", "100"]
      }
  },
  "id": 3
}

然后我执行了此查询请求

Then I did this query request

GET/localhost:5000/transactions/c6b0c82d-27f9-4c2c-8305-34b413d95057

并将其作为REST响应

and got back this as REST response

{
  "type": 2,
  "chaincodeID": "EgRteWNj",
  "payload": "Ch8IARIGEgRteWNjGhMKBmludm9rZRIBYRIBYhIDMTAw",
  "uuid": "c6b0c82d-27f9-4c2c-8305-34b413d95057",
  "timestamp": {
    "seconds": 1469643763,
    "nanos": 524731069
  }
}

那么,如果有什么方法可以解密/更改Ch8IARIGEgRteWNjGhMKBmludm9rZRIBYRIBYhIDMTAw以显示A transferred 100 to b或类似内容,至少对于技术含量较低的用户来说是可读的?

So if there's anyway to decrypt/change Ch8IARIGEgRteWNjGhMKBmludm9rZRIBYRIBYhIDMTAw to showing A transferred 100 to b or something similar, at least being readable for less-technical users?

推荐答案

仅对有效负载进行了编码,您可以使用对其进行解码(编码为base64). javascript中也有此函数来对其进行解码.

The payload is just encoded, you can use this to decode it (the encoding is base64). There is also this function in javascript to decode it.

如果启用了安全性/保密性,则有效负载也会被加密,因此您需要使用证书来解密有效负载,然后才能对其进行解码.

If you had security/privacy enabled, the payload would be encrypted too, so you would need the Certificate to decrypt the payload and then you could decode it.

这篇关于解密超级账本中的有效载荷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆