Can I use the public/private key generated by the MSP in Hyperledger Fabric v1.0 for encrypting/decrypting data?

南笙酒味 提交于 2021-02-07 07:36:35

问题


In Hyperledger Fabric v1.0, a user can be registered and enrolled in the blockchain network through the MSP (member services provider). The user is given a public key (in the certificate) and a private key after registration and enrollment. The way I understood it, the private key is used by the invoker to sign the transaction, while the public key is used by the peers to verify the signer.

Can I use the same private and public key to encrypt (using the public key) and decrypt (using the private key)?

If yes, what Node.js library do I need to use these keys generated by MSP for encryption and decryption? I tried using the crypto package but it does not work. It produces the following error:

Error: error:0608B096:digital envelope routines:EVP_PKEY_encrypt_init:operation not supported for this keytype

I tried using the crypto package in an RSA public/private key pair generated by OpenSSL (and not MSP) and the encryption/decryption worked.


回答1:


Hyperledger Fabric 1.0.* does not support RSA keys for signing. Signing keys must be ECDSA keys as this is the only type that is currently supported. For details please see the documentation.



来源:https://stackoverflow.com/questions/45134946/can-i-use-the-public-private-key-generated-by-the-msp-in-hyperledger-fabric-v1-0

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