title: Is it possible to have encryption with multiple private keys (PHP)?
body: <p><strong>Or: How to store encrypted data for a bunch of users?</strong></p>
  
  <p>I admit, it's a silly question, a private key is limited to only one person as the term already implies. But I have the following scenario:</p>
  
  <p>User Tom enters data that needs to be stored encrypted in a database. The user decides he wants to make this information available to Jim and Bob. The users John and Jayne must not be able to decrypt it. Of course also not to user Tim who hacked the server and has access to the encrypted data and the scripts that do the encryption/decryption.</p>
  
  <p>I think the public key/private key approach with PHPs <a href="http://php.net/manual/en/function.openssl-public-encrypt.php" rel="noreferrer">openssl_public_encrypt</a> function won't work here as two users need to have that "private" key to decrypt the data.</p>
  
  <p>I guess this a rather general question, but if it's important, it must be done in PHP (and MySQL maybe).</p>