In Huawei cloud blockchain application development, how to use Node.js to complete the message body signature of its REST API chain code call request?

in the API reference document of Huawei Cloud blockchain Service, Huawei Cloud has the following description for the message header requesting its REST API service:

x-bcs-signature-sign: to ensure that only authorized callers are allowed to make legitimate chain code calls, you need to use the user private key downloaded in the download user certificate section to encrypt and sign the SHA256 digest of the entire request message body using ECDSA elliptic curve encryption. The x-bcs-signature-sign value is the signature result.

at the same time, Huawei Cloud provides examples of calls using the GE language. But I want to use Node.js to complete such a process. It"s easy to do a SHA256 digest on the body of the request message, but how to use the user"s private key to use the ECDSA elliptic curve as an encrypted signature baffles me. The user"s private key provided by Huawei Cloud is similar to the following format:

-BEGIN PRIVATE KEY-
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgpCc4N3LiESy7UjPN
lL56fjWSBTL251fNNbcfq+T0RdahRANCAAQ0OtXGMFtVUiLtADfnfp3AVTYLrsVV
fZFDy+V7zcI30Mdo86JquXuAr0toDnSRbGutiVhnU+pLOGTAO7o9PfaC
-END PRIVATE KEY-

I Xiaobai has just touched the blockchain, hoping that a great god can give me some advice.

attached: Huawei Cloud blockchain Service API reference
https://support.huaweicloud.c...

Huawei Cloud REST API example:
https://support.huaweicloud.c...

Menu