In Huawei Cloud Block Chain Service API Reference Document, Huawei Cloud has the following description for the message header requesting its REST API service:
X-bcs-signature-sign: In order to ensure that only authorized callers can make legal chain code calls, it is necessary to use the user private key downloaded from the download user certificate chapter to encrypt and sign the SHA256 digest of the whole request message body in the way of ECDSA elliptic curve encryption. The value of x-bcs-signature-sign is the result of the signature.
At the same time, Huawei cloud provides an example of using Go language. But I hope to use Node. JS to complete this process. It is very simple to abstract the request message body from SHA256, but how to use the user’s private key to encrypt the signature with ECDSA elliptic curve is difficult for me. The user private key provided by Huawei Cloud is similar to the following format:
—–BEGIN PRIVATE KEY—–
—–END PRIVATE KEY—–
Xiao Baigang has just touched the block chain. I hope Dashen can point out the labyrinth.
Attachment: Huawei Cloud Block Chain Service API Reference
Huawei Cloud REST API example: