Decrypting the payload in hyperledger

假如想象 提交于 2019-12-24 06:44:19

问题


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.

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

and got back this as REST response

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

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?


回答1:


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.



来源:https://stackoverflow.com/questions/38617428/decrypting-the-payload-in-hyperledger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!