Suppose I have Company1 with their own Public/Private Key Pairs and another Company2 with their public/private key pairs and yet another Company3 with their public/private key pairs.

Is there any way/algorithm to encrypt a piece of data, given we provide Company1 and Company2 public keys to it, such that the encrypted data can be decrypted by EITHER ONE of their private keys. i.e. upon receiving the encrypted data, Company1 can use their private key to see what it actually is, and so can Company2, without them knowing each other's private keys. Also, Company3 should in no way be able to decrypt that data.

I've also been looking at Shamir's Secret Sharing algorithm. It works somewhat for our use case, assuming we encrypt each share using PGP and share it to the companies. In our specific use case, the bottleneck is that any data sharing between the companies happens on a shared ledger/database -- so by default everyone sees everything. Also not sure what the maximum number of shares are in this case, as its possible the list will grow to hundreds of shares being generated.


Yes, quite easily, with key encapsulation and the appending the symmetric key twice (encrypted for each company)

Encrypt the data with a random AES key. For each recipient, encrypt the AES key with the respective public key. The ciphertext is the concatenation of the symmetric encrypted data and the various encryption and of that symmetric key.

More theoretically, you could use identity-based encryption, which is close to what you describe. That does require a common setup, though, and possibly someone having a master key.

  • $\begingroup$ I've been looking at openpgp in Golang. (I'm a programmer, so a lot of theoretical cryptography stuff goes over my head). It looks like when using PGP I can specify multiple recipients which is very well suited to this. I think it does what you described under the hood? $\endgroup$ – Haardik Haardik Mar 16 at 18:59
  • $\begingroup$ and when I need to add a new company to the list of orgs who can decrypt and read the data, one of the companies which already has access to it can decrypt it, and re-encrypt it by adding company3 to the array of recipients as well $\endgroup$ – Haardik Haardik Mar 16 at 19:00

PGP permits this very thing using hybrid encryption. You might want to take a look at how it works.

Here's one article that explains it.

  • $\begingroup$ It's actually the same principle in S/MIME for multiple recipients. $\endgroup$ – not2savvy Mar 18 at 11:19

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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