0

The expected outcome is very simple:

Users will send their ERC20s to a smart contract. Depending on the amount, each user will get a file specifically created for them. I want to distribute that files in a decentralized way without requiring users to send their email address in the smart contract interaction.

Therefore I expect to have the files (a .tar.gz for each user). That file will be encrypted with the Ethereum public key of the user and can only be decrypted with their private key, therefore allowing ONLY them to access the content inside the .tar.gz

I already investigated the potential solutions and I found this which honestly I feel is unrelated to solving my problem or it's not clear. They are using Ethereum Smart contract to verify (I guess that should happen client side).

Someone suggested on encrypting a message using ethereum public key here Does that mean I could simply create the .tar.gz secret password using the user public key which can only be decrypted by their private key? How safe are .tar in this case?

Any suggestions are welcomed

EDIT: I would also love a solution using web3.eth.personal.sign if such solution is viable

1
  • 1
    I think your problem is just too specific and it is hard to give you a right answer without knowing all the details. Yes, you can use private/public key pairs to share information with your users, for example an encryption key (in your case ECIES like an answer pointed by you). Ethereum doesn't deal with encryption so frameworks/libraries do not have a encryption algorithm, but you can use AES which is pretty popular with many implementations. Archives .tar.gz or .tar or .gz do not deal with encryption directly you have to use other tool perhaps GPG but you have to share the key pairs.
    – Ismael
    Sep 8, 2019 at 19:03

1 Answer 1

0

I found a relevant answer however I won't accept mine yet as I'd like to get other responses.

Using GPG seems to [be]1 relatively easy to encrypt files in a relatively secured way. According to this source:

John wants to upload a PDF file to IPFS but only give Mary access He puts his PDF file in his working directory and encrypts it with Mary’s public key He tells IPFS he wants to add this encrypted file, which generates a hash of the encrypted file His encrypted file is available on the IPFS network Mary can retrieve it and decrypt the file since she owns the associated private key of the public key that was used to encrypt the file A malicious party cannot decrypt the file because they lack Mary’s private key

In our case the public key is the blockchain public address. The user will have to use their private key to get access to the files. I would love to know if someone can think of other ways

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.