I would like to make a secure-encrypted file sharing system. The files will be sent into an open decentralized system, so the files would be encrypted before sending it to the decentralized storage system (all encrypted files are visible).

I would like to sell the access to the files, is it possible to generate a decryption key, usable only by the persons who buy the access to this file, who has a public/secret key, and we have his public one.

For example :

  1. Alice encrypts a file to be decrypted by yet-unknown multiple parties later on.

  2. Bob interacts with Alice to download and decrypt the contents of the file

  3. the system should not allow a third party Charlie to decrypt the file solely based on the information that was sent from Alice to Bob.

  4. Alice should not have to re-encrypt the file once it has been downloaded (and possibly decrypted) by Bob.

Does a solution exist for this problem? I read about Shamir's Secret Sharing, but it doesn't look like it fulfills my need.

  • If the person who buys the access has a public and a private key why don't encrypt the files with his public key and let him decrypt it with his private key?
    – Mr. E
    Nov 2, 2016 at 16:12
  • @Mr.E because it would be costly to encrypt the file each file, and store the file in the p2p platform, each time an user buys the access.
    – David P
    Nov 2, 2016 at 16:21
  • 1
    I don't get it. Are all the files the same for all users? If it is,why you need a key per user? What about encrypting the files with AES and give the user the AES key encrypted with the user's public key?
    – Mr. E
    Nov 2, 2016 at 16:26
  • 1
    What this sounds like to me is a form of DRM: instead of trying to control access to the files, you let everyone have them in encrypted form, and control just the decryption keys. Is that right? Nov 2, 2016 at 18:16
  • @XiongChiamiov Yes it is something like a DRM we are talking about. We have rewritten the example to be more understandable.
    – David P
    Nov 3, 2016 at 9:21

1 Answer 1


Alice encrypts each file (F1, F2, ...) with a unique, randomly generated AES-256 key. When Bob pays Alice for access to F1, she encrypts the AES key for file F1 with Bob's public key. Bob can now decrypt the AES key, recover the key to F1, and view the file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .