简体   繁体   English

如何使用 Hyperledger Fabric 中生成的 ECDSA 私钥和公钥进行加密和解密

[英]How to encrypt and decrypt using ECDSA private key and public key generated in Hyperledger fabric

I am working on a basic-network project on Hyperledeger Fabric V-1.4.1 .我正在研究Hyperledger Fabric V-1.4.1上的基本网络项目。 I have enrolled an admin and created a user using enrollAdmin.js and registerUser.js .我已经注册了一个管理员并使用enrollAdmin.jsregisterUser.js创建了一个用户。 A public Key and a private key is generated for user1 .user1生成公钥私钥 Now I want to use that private key to sign simple data and later verify using the public Key .现在我想使用该私钥对简单数据进行签名,然后使用公钥进行验证 I have tried using URSA node module which works fine with RSA keys generated through OpenSSL but isn't working with these two keys.我尝试使用URSA节点模块,该模块适用于通过OpenSSL生成的 RSA 密钥,但不适用于这两个密钥。 Probably because these keys are not RSA , they are ECDSA keys.可能是因为这些密钥不是RSA ,它们是ECDSA密钥。 I have also read the documentation of the Crypto node module and it seems I need to have .pem files as keys to use in Crypto module.我还阅读了Crypto节点模块的文档,看来我需要将.pem文件作为密钥才能在Crypto模块中使用。 But In fabric, I have key files as -priv and -pub format.但在织物中,我有-priv-pub格式的密钥文件。
Is there any node module that can encrypt decrypt using ECDSA keys?是否有任何节点模块可以使用ECDSA密钥加密解密?
Is there any specific way in hyperledger fabric to do this?超级账本结构中是否有任何特定方法可以做到这一点?
Or is there any other way I can do this thing?或者有没有其他方法可以做这件事?
Please ask any questions if necessary.如有必要,请提出任何问题。
Thank you.谢谢你。

The two formats you see你看到的两种格式

  • priv隐私
  • pub酒馆

Are wallet formate of filestorage是文件存储的钱包格式

Try to register an identity and enroll with fabric-CA by importing identity service then you will receive certificate and private key just put it in a file and mark the extension as pem and it will work尝试通过导入身份服务注册身份并使用fabric-CA注册,然后您将收到证书和私钥,只需将其放入文件中并将扩展名标记为pem即可

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

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