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
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.