简体   繁体   English

我可以使用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?

In Hyperledger Fabric v1.0, a user can be registered and enrolled in the blockchain network through the MSP (member services provider). 在Hyperledger Fabric v1.0中,用户可以通过MSP(成员服务提供商)注册并注册到区块链网络中。 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? 如果是,我需要使用哪些Node.js库来使用MSP生成的这些密钥进行加密和解密? 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. 我尝试在OpenSSL(而不是MSP)生成的RSA公钥/私钥对中使用加密包,并且加密/解密有效。

Hyperledger Fabric 1.0.* does not support RSA keys for signing. Hyperledger Fabric 1.0。*不支持用于签名的RSA密钥。 Signing keys must be ECDSA keys as this is the only type that is currently supported. 签名密钥必须是ECDSA密钥,因为这是目前唯一支持的类型。 For details please see the documentation . 有关详细信息,请参阅文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM