开发者

Shared encrypted file but using different key to decrypt

开发者 https://www.devze.com 2023-03-17 06:36 出处:网络
I just curious, if there any encryption algorithm that can support this scenario. A plain text file (T) was shared among two parties, this file was encrypted (let say symmetric AES) to become encrypt

I just curious, if there any encryption algorithm that can support this scenario.

A plain text file (T) was shared among two parties, this file was encrypted (let say symmetric AES) to become encrypted file (E). The Encrypted file will be stored in the server, and after encryption takes place, additional party can be added at any time.

When first party wants to get the T file, he/she passes P1K to decrypt E file when second party wants to get the T file, he/she passed P2K to decrypt E file.开发者_开发问答

Any idea how to achieve this using pure encryption algorithm only (without using database to store intermediary key) ?


If the sender already has the public key component for the intended recipients of the secret message than this can be done with GnuPG using paired key encrpytion.

The sender needs to encrypt the data to the public key of the intended recipients (maybe the senders own key as well) and only those people will be able to use their private key to decrypt the secret message.

Not sure if the requirement to preawareness of or access to the receivers public keys is an issue or disqualifies the answer as a type of database of info that the sender must have.

All users get to keep their private bits to themselves though as opposed to if they all had to have shared the same password, in this case no user has access to the private key any of their contacts.

http://www.gnupg.org/


The plain text (T) can be encrypted with a secret key (Ks) using a symmetric cipher like AES.

Ks is encrypted with as many public keys that is allowed to know the symmetric cipher and added as part of the encrypted message packet.

Decryption just means iterating through the list of encrypted Ks against the private key of a user.


Who passes what key to whom? (Also, traditionally P for plaintext and C for ciphertext.)

And there's an easy answer (unless I'm misunderstanding you, which is an obvious possibility since your question isn't very clear): Give each recipient "half" of the key in the first place, and the other half when you want them to be able to decrypt the message.

How do you split a key in half? A decent way is to XOR it with a nonce: give person 1 K⊕N1 and person 2 K⊕N2. When you want them to decrypt the message, give them N1 or N2 respectively.

Another easy answer is to just give each person the key encrypted with the recipient's public key when you want them to decrypt the message.

0

精彩评论

暂无评论...
验证码 换一张
取 消