tags:

views:

909

answers:

2

Is there a way to store data in an encrypted way such that it can be decrypted with several different keys?

IE, if I've encrypted data with key1, but I want to be able to decrypted with keys 2, 3, and 4.

Is this possible?

+4  A: 

Yes, it's possible. Google "multiparty encryption" for a start.

AFAIK, there are no drop 'em in and use 'em packages for it though.

-- MarkusQ

P.S. For a sketch of how it could be done, consider this. The encrypted message consists of:

  • the payload, encrypted with a one-time pad
  • the one time pad, encrypted with key1
  • the one time pad, encrypted with key2
  • ...
  • the one time pad, encrypted with keyN

The recipient who hold key i just decrypts their copy of the pad with their key, and then decrypts the payload.

However, this is just a proof that it could be done and would suck as an actual implementation. If at all possible, you should avoid rolling your own encryption. If you don't understand why, you should definitely avoid rolling your own encryption.

-----Edit ------------

If I'm wrong and the Gnu tools do that, use them. But I can't seem to find any information on how to do it.

MarkusQ
What might suck about this is that once you know the one time pad, you have a known plain text, along with the encrypted values for other keys. Using this information, you could make it easier to find out what the others keys are.
Kibbee
Googling "multiparty encryption" doesn't turn up much. You'll likely have better luck with "broadcast encryption" which encompasses this case as well.
stak
+8  A: 

GnuPG does multi-key encryption in standard.

The following command will encrypt doc.txt using the public key for Alice and the public key for bob. Alice can decrypt using or private key. Bob can also decrypt using his private key.

gpg --encrypt --recipient [email protected] \
    --recipient [email protected] doc.txt

This feature is detailed in the user guide section entitled "Encrypting and decrypting documents"

David Segonds
I took a quick look at GnuPG doco, but couldn't find mulit-key decryption. Would you mind pointing out where it is? Thanks.
Mitch Wheat
Ditto. It be cool to know how to do that, but I can't find hide no man page on it.
MarkusQ
Added more info.
David Segonds