Shoumik Hoque
Shoumik Hoque

Reputation: 142

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. I have enrolled an admin and created a user using enrollAdmin.js and registerUser.js. A public Key and a private key is generated for 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. Probably because these keys are not RSA, they are ECDSA keys. 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. But In fabric, I have key files as -priv and -pub format.
Is there any node module that can encrypt decrypt using ECDSA keys?
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.

Upvotes: 1

Views: 1878

Answers (1)

Narendranath Reddy
Narendranath Reddy

Reputation: 4133

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

Upvotes: 1

Related Questions