I need to encrypt data asymmetrically (binary as well as text) with a public / private key system. Currently I'm using openssl_seal, because I need to encrypt the data with more than one public key. As a result I get an encrypted message (which is fine) and two or more envelopes (which is not so fine). The latter one is not so fine, because I have to store these envelopes into the database as well. And for each little message, I need to store at least two envelopes, which might me larger than the message itself.
Then I remembered GnuPG: I can write a mail to more than one receipient and can encrypt the message that way, that everyone can decrypt the message with his/her own private key. No envelopes needed. So I looked for a GnuPG library in PHP but I only found a linux solution. Unsatisfying because we have windows systems as well.
Is there any public / private key library out there, which can encrypt messages/data with more than one public key without bothering with envelopes?
What I need is a library which can create a public/private key set, 2048 or 4096 bit strong.
The library must have a function to encrypt any kind of data with one, two or more public keys and has a simple data block as result only.
The library must have a function so that the encrypted data can be decrypted with any of the corresponding private keys.
Any hints or ideas? Maybe there is a special function in OpenSSL? IIRC, I can write e-mails to several receipients with S/MIME encryption as well. And it's only 1 e-mail with many receipients. No seperated envelopes.
Thanks in advance
Hennes