1

Is there any way to encrypt/decrypt data using web3js library(or any other standard tool), so that only user having access to public/private key can store and read data onto ethereum blockchain.

Scenario could be: A user stores sensitive information in encrypted file on IPFS and then using smart contract store encrypted hash of IPFS file onto blockchain, in future when he can access encrypted hash of IPFS file from blockchain using smart contract and view information.

In this scenario user has not remembered(stored) any thing except Ethereum private key.

kherwa
  • 724
  • 4
  • 13
  • To be sure, your question is that you want to block people not having a (certain?) key pair from accessing the blockchain? (Everyone can read the blockchain, they do not need a key for this). – JBrouwer Mar 30 '18 at 12:13
  • yes, user will store encrypted secret onto public blockchain, so that only he can read it. – kherwa Mar 30 '18 at 12:34
  • Yes anyone can read, but that information will be encrypted. so only user can decrypt this information using his private key. – kherwa Mar 30 '18 at 13:09
  • Yes that is possible, choose an encrypt/decrypt algorithm, encrypt a string, put it on blockchain and let the user decrypt it (off-chain) using his private key. – JBrouwer Mar 30 '18 at 13:35
  • wanted to do this with web3js library so that users ethereum account can be used. but i think web3js library doesnot supports this. – kherwa Mar 30 '18 at 14:13
  • 2
    You now can use OpenPGPjs that now support encryption using private keys from elliptic curves (like those used by Ethereum). – Ismael Mar 30 '18 at 15:32
  • yes this looks like good option but for using OpenPGPjs, we have to generate a new key pair. i was thinking of using same ethereum key pair. – kherwa Mar 30 '18 at 18:30
  • It should be possible to import an existing ECC key into OpenPGPjs? – ivicaa Mar 30 '18 at 19:43

0 Answers0