我可以使用Hyperledger Fabric v1.0中由MSP生成的公钥/私钥来加密/解密数据吗? [英] Can I use the public/private key generated by the MSP in Hyperledger Fabric v1.0 for encrypting/decrypting data?

查看:86
本文介绍了我可以使用Hyperledger Fabric v1.0中由MSP生成的公钥/私钥来加密/解密数据吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Hyperledger Fabric v1.0中,可以通过MSP(会员服务提供商)在区块链网络中注册和注册用户.注册和注册后,将为用户提供一个公共密钥(在证书中)和一个私有密钥.据我了解,调用方使用私钥对事务进行签名,而对等方使用公钥来验证签名人.

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)?

如果是,我需要哪个Node.js库来使用MSP生成的这些密钥进行加密和解密?我尝试使用crypto软件包,但是它不起作用.它产生以下错误:

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

我尝试在由OpenSSL(而非MSP)生成的RSA公钥/私钥对中使用加密包,并且加密/解密有效.

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

推荐答案

Hyperledger Fabric 1.0.*不支持用于签名的RSA密钥.签名密钥必须是ECDSA密钥,因为这是当前唯一支持的类型.有关详细信息,请参见

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.

这篇关于我可以使用Hyperledger Fabric v1.0中由MSP生成的公钥/私钥来加密/解密数据吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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