1

This question already has an answer here:

I am trying to make a document sharing app after signing the NDA between 2 parties.

My Smart contract saves the address of involved parties as Sender(Party1 who makes the NDA) and recipient(Party2 who signs the NDA).

Once both parties signs NDA I want to share the documents between 2 parties for via smart contract.

I am planning to upload the encrypted document(which is encrypted by user while uploading) on a Server and keep the address and decryption key inside the smart contract itself and once NDA expires delete all the decryption keys from Contract so that users can not access documents anymore.

Problems I am facing are :

1, User do not want the name and address of parties to be readable in Smart contract so I need to encrypt everything inside Smart contract and only the involved parties should be able to decrypt and read the details of contract.

If I can do this then the address of document and encryption key to document will also remain safe.

What kind of en/decryption can I use for this situation?

I do not want to pass the encryption/ decryption keys between users.

Is there any public and private keys attached to Ethereum accounts?, If Yes, How can I make use of those?

Please advise If my whole approach seems doubtful to you.

marked as duplicate by Ismael, Richard Horrocks, flygoing, eth Jan 6 '18 at 11:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Tha main issue is that everything inside a smart contract is public. If you store a private keys inside the smart contract then everybody will have access to it. A possible workaround is to use homographic encryption, but no implementation is available in solidity yet, and perhaps it is too expensive to use in current blockchain. – Ismael Jan 4 '18 at 2:50
  • Somethings I Understood, – Manish Jan 4 '18 at 5:19
  • Here is an example of homomorphic encryption youtube.com/watch?v=vNPfG0Ly6Go – Lismore Jan 4 '18 at 16:31